Read last n lines from a file using Java

Introduction Here I will show you how to read last n lines from a file using Java programming language. I am using text file for this example. Last “n” lines means, last 10 lines or 20 lines or 30 lines, etc. So “n” should be replaced by an appropriate non-zero positive integer value. Obviously the tail of the file is harder to do and this is really a much more challenging situation than getting the first n (10, 20, 30 etc.) lines. Because you are habituated to read the file…

Continue

Generate File with Random Content in Java

Introduction This tutorial will show you how to generate file with random content in Java. We will generate random content in a text file using wordnet-random-name API in Java. You can set limit to any number of lines for the text file to hold generated random content in it. This kind of random content is a quick and an easy to use for your application purpose where you need lots of content for performing testing. So this ready-made API generates large content to solve your purpose.

Continue