The below command is need when installing Java on a Linux machine (saw the command in a tutorial).
alternatives --install /usr/bin/java java /usr/java/jre1.
There is still no good explanation on the priority, but it seems larger numbers are considered to have higher priority than smaller numbers.
alternatives --display java
also displays the priority. I noticed /jre-1.4.2 is added with a priority of 1420, so it would make sense the number the priorities according to the version number of the jre.