Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Unknown Source)
at java.lang.AbstractStringBuilder.expandCapacity(Unknown Source)
at java.lang.AbstractStringBuilder.append(Unknown Source)
at java.lang.StringBuffer.append(Unknown Source)
And think about whether you actually need all "95000 lines" in memeory at the same time. You would be better off reading a line, processing that line, reading the next line. Only rarely do you actually need all of the data in memory at the same time.