Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes decrease int value whenever a minute passes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "decrease int value whenever a minute passes" Watch "decrease int value whenever a minute passes" New topic
Author

decrease int value whenever a minute passes

Sanjul Jain
Greenhorn

Joined: Oct 21, 2004
Posts: 14
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

Joined: Aug 20, 2001
Posts: 1817

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.


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
 
jQuery in Action, 2nd edition
 
subject: decrease int value whenever a minute passes
 
Similar Threads
generics doubt
Array Declaration
Notrajon Mock Question 18
multidimentional array
binary search