Here you can find the source of bubbleSort(int[] source)
public static int[] bubbleSort(int[] source)
//package com.java2s; //License from project: LGPL public class Main { public static int[] bubbleSort(int[] source) { for (int i = 1; i < source.length; i++) { for (int j = 0; j < i; j++) { if (source[j] > source[j + 1]) { swap(source, j, j + 1); }//from w ww. j av a 2 s . com } } return source; } public static int[] swap(int[] ints, int x, int y) { int temp = ints[x]; ints[x] = ints[y]; ints[y] = temp; return ints; } }