Simply, if you know the number of lines, i.e. how many lines inside your file,
then apply a for() loop,
starting from the last line, count backward by 150,
e.g.:
String[] SomeBuffer = new String[150];
int j=0;
for (int i=NumberOfLines; i > (NumberOfLines - 150); i--)
{
j++;
}
You should be careful about the Line index numbers.
For example, idx=0,1,2,3 means 4 records, not 3.
Also it would be better to do some preliminary calculations before you read the lines,
like how many lines? or what's the maximum length of a line?, etc.
( agree with Sergey Kryukov and others that you should provide more information)