java - How do you sort an array of integers? -


firstly, beginner java , programming in general of solutions i've seen question aren't understandable me.

however... basically, have array of temperatures, given arguments. i.e. temp[0] = 30, temp[1] = 31, temp[2] = 31, temp[3] = 30

the catch need sort these temperatures numerical order can find median temperature. however, unsure how this.

any ideas? thinking along lines of creating second array with temperatures in order index increase. finding middle value of middle index along lines of orderedtemps[(args.length - 1) / 2] (using if statement determine between , odd number of args median differ).

however, i'm unsure how go sorting process , creating second array sorting it... tips?

you can try median org.apache.commons package.


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -