File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Murach's Java Servlets and JSP this week in the Servlets 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

decrease int value whenever a minute passes

Sanjul Jain

Joined: Oct 21, 2004
Posts: 14

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,
Joel McNary

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.
It is sorta covered in the JavaRanch Style Guide.
subject: decrease int value whenever a minute passes
Similar Threads
generics doubt
Array Declaration
Notrajon Mock Question 18
multidimentional array
binary search