Reputation: 271
how do you properly setup android countdown output such that it will always have 2 digits places?
For example: 02:03 or 02:05 would be the correct output
Current output: 2:3 or 2:5
I tried two implementations that output the same thing:
g.drawString("TIME: " + ((milliSec / (1000*60)) % 60) + " : " + ((milliSec / 1000) % 60 ), 150, 110);
g.drawString("TIME: " + String.format("%d : %d ",
TimeUnit.MILLISECONDS.toMinutes( milliSec),
TimeUnit.MILLISECONDS.toSeconds(milliSec) -
TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(milliSec))),150,110);
g.drawString("SCORE: " + board.getScore(), 150,50);
Upvotes: 0
Views: 41