Help me with references



i am working on bubblesort method and the swap method is giving trouble
because the values are being change,there are byval. So i looking for
a way to make swap work and change the values of the arguments.



public class a {

public static void main(String[] args) {

// create the array

int[] array = {4,2,3,5,6,7,8,10,9,11};

functions a = new functions();

a.randomload(array);
a.bubblesort(array);

}
}
class functions {
public void randomload(int[] array) {
int count;
for (count = 0; count<= array.length-1; count++)
array[count] = (int) (java.lang.Math.random() * 10);

}

public void bubblesort(int[] array) {
int count;
boolean blnswap;

blnswap = true;

while (blnswap = true) {
blnswap = false;
for(count = 0; count <= array.length -2; count++)
if (array[count] > array[count + 1]) {
swap(array[count],array[count +1]);
blnswap = true;
}
}
}
public void swap(int num,int num2) {
int temp;
temp = num;
num = num2;
num2 = temp;
}
}

.



Relevant Pages