I have a PHP code:
$array['cows'] = 4;
$array['horses'] = 7;
$array['cats'] = 9;
$array['dogs'] = 2;
arsort($array);
How to do it in Java?
Sorted (from max) output of 'print_r($array);' is:
Array
(
[cats] => 9
[horses] => 7
[cows] => 4
[dogs] => 2
)