My goal is to sort an array of a class, for example myClass
Sort the memory locations:
For example if myClass[0] has a greater memorylocation than myClass[1] then i would like them to exchange place. Switch places are easy, but how do i find out what memorylocation is the greatest?
this doesn't work, but you might get the idea of what i want to do:
if(memorylocation of myClass[0] > memorylocation of myClass[1])
//exchange memoryadresses
for example: i want to change the memoryadresses below
System.out.print(myClass[0]); -----> myClass@279febb9
System.out.print(myClass[1]); -----> myClass@24db06de
System.out.print(myClass[2]); -----> myClass@28db06de
System.out.print(myClass[3]); -----> myClass@23db06de
to this:
System.out.print(myClass[0]); -----> myClass@23db06de
System.out.print(myClass[1]); -----> myClass@24db06de
System.out.print(myClass[2]); -----> myClass@279febb9
System.out.print(myClass[3]); -----> myClass@28db06de