Java Sorting Program Using Javascript Variables