Revision: 35847
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 14, 2010 13:28 by mouseroot
Initial Code
public static double[] SortArray(double[] vals)
{
double temp=0;
double ret[]= new double[vals.length];
for(int c=0;c < vals.length;c++)
{
for(int d=0;d < vals.length - 1;d++)
{
if(vals[d+1] < vals[d])
{
temp = vals[d];
vals[d] = vals[d + 1];
vals[d + 1] = temp;
}
}
}
ret = vals;
return ret;
}
Initial URL
Initial Description
This is a Bubble Sorter in java (was a pain in the ass to get right) you can change the sorting style from ascending to descending order by changing the line if(vals[d+1] < vals[d]) to if(vals[d+1] > vals[d])
Initial Title
Bubble Sort Arrays in java
Initial Tags
Initial Language
Java