Quickest and most efficient method to search top 3 numbers?

Posted by Donal Rafferty on Stack Overflow See other posts from Stack Overflow or by Donal Rafferty
Published on 2010-05-25T09:28:08Z Indexed on 2010/05/25 9:31 UTC
Read the original article Hit count: 133

Filed under:
|
|
|

I currently have an array of around 8 - 10 numbers that changes on a periodic basis.

So around every 5 - 10 seconds the numbers get updated.

I need to get the top 3 numbers in the array every 10 seconds.

This is all done on a mobile device.

At the minute I iterate through the array 3 times and each time I take out the three highest numbers and place them in three previously declared variables.

My question is what should I look to do to increase speed and efficiency in this instance?

© Stack Overflow or respective owner

Related posts about java

Related posts about android