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

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -