Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

decrease int value whenever a minute passes

 
Sanjul Jain
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

I am a newbie to java and shall greatly appreciate your help.

I have an array of capacity 10 with values say {0,3,1,0,0,0,0,0,0,0}

the values in array, which are not zero, need to be decremented to 0. e.g. 3 needs to be decremented to 0. the criteria for decreasing value of 3 is that 3 should decrement by 1, after 1 minute of system time, until 3 is 0, and the value of 3 should be replaced by 0, in the array.


Thanks in advance,
Sanjul
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What code do you have to do this?

Are the numbers supposed to be decreased one at a time, or all at once?
That is , does the array {1, 2, 3} go to {0, 2, 3} or to {0, 1, 2}?

Possibly the simplest way it to sleep the thread. Otherwise, you may need to use some sort of timer.

Post what code you have, and we'll see if we can help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic