Print counting in loop java -



Print counting in loop java -

i have java programme simulates values , returns them. want see how far simulation printing current state.

ex:

system.out.print("number of simulations: "); for(int i=0;i<number_of_simulations;i++){ /* calcutions*/ system.out.print("\b" + i); }

i thougth possible, output is: number of simulations: 0?1?2?3?4?5?6?7?8?9?10?11?12?

i want see current state, not counter. if i++ current removes , i+1 shown.

\b go 1 char. pawel veselov said, utilize \r go origin of line. of import thing that, depending on you're testing output (ide), won't work expected. should test in shell (windows cmd or linux terminal) in order see real result.

java loops printing

Comments

Popular posts from this blog

ruby on rails - Devise Logout Error in RoR -

model view controller - MVC Rails Planning -

php - Working with pretty urls on apache and fastcgi after hhvm installation -