public static void Sort(int[] data, int n) { int i, j, temp, tag; for (i = 0, tag = 1; i <n - 1 && tag == 1; i++) { tag = 0; for(j=0;j<n-i-1;j++) { if (data[j] > data[j + 1]) { temp = data[j]; data[j] = data[j + 1]; data[j + 1] = temp; tag = 1; } } } }