Java Array - Ranking Elements
I need an algorithm to rank elements of an array according to size. Lets say for example. I have an array (type int) of size 10 as follows:

[79, 5, 18, 5, 32, 1, 16, 1, 82, 13]

I need to rank the entries by size. So 82 should receive rank 1, 79 rank 2 etc. If two entries have the same value they receive the same rank and the rank for a lower value is raised. So for our array, the new ranking array would be:

[2, 7, 4, 7, 3, 9, 5, 9, 1, 6] 

How do I go about doing this? I also require a reverse procedure, i.e. it ranks lower entries lower and higher entries higher. So the new array would be:

[9, 3, 7, 3, 8, 1, 6, 1, 10, 5]

Please provide me with the appropriate code. Thanks!
Java Array - Ranking Elements
===

I need an algorithm to rank elements of an array according to size. Lets say for example. I have an array (type int) of size 10 as follows:

[79, 5, 18, 5, 32, 1, 16, 1, 82, 13]

I need to rank the entries by size. So 82 should receive rank 1, 79 rank 2 etc. If two entries have the same value they receive the same rank and the rank for a lower value is raised. So for our array, the new ranking array would be:

[2, 7, 4, 7, 3, 9, 5, 9, 1, 6] 

How do I go about doing this? I also require a reverse procedure, i.e. it ranks lower entries lower and higher entries higher. So the new array would be:

[9, 3, 7, 3, 8, 1, 6, 1, 10, 5]

Please provide me with the appropriate code. Thanks!