Java class that sorts a file of generated lines from left to right, top to bottom (ask me why I made this if you are interested)