java - how to get code to print vertically -


so having trouble printing code vertically, no matter do, continues print horizontally. first image how output looks , second image should be.

// pixel counter  (y = 0; y < height; y++) {     (x = 0; x < width; x++) {         pixelcounter [s.nextint()/ binwidth] += 1;     } }  // histogram (int q = 0; q < pixelcounter.length; q++) {     if (binmin < 10) {         system.out.print(" " + binmin + ":");         } else {         system.out.print(binmin + ":");     }     int num_stars = (int) ((((double) pixelcounter[q] * 100.0/ area)) + 0.5)     (i = 0; < num_stars; i++) {         system.out.print("*");     }     system.out.println();     binmin += binwidth; } 

this output looks like

this output supposed like

you should use:

system.out.println(" " + binmin + ":"); 

if use system.out.print(" " + binmin + ":"); print in same line.

changing println make sure output printed on separate lines.


Comments

Popular posts from this blog

php - Auto increment employee ID -

php - isset function not working properly -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -