Generates a skyline based on coordinates of a line of buildings (Java)