Here you can find the source of bubbleSort(String[] p_array)
public static void bubbleSort(String[] p_array) throws Exception
//package com.java2s; //License from project: MIT License public class Main { public static void bubbleSort(String[] p_array) throws Exception { boolean anyCellSorted; int length = p_array.length; String tmp;//from www . j a va 2s. co m for (int i = length; --i >= 0;) { anyCellSorted = false; for (int j = 0; j < i; j++) { if (p_array[j].compareTo(p_array[j + 1]) > 0) { tmp = p_array[j]; p_array[j] = p_array[j + 1]; p_array[j + 1] = tmp; anyCellSorted = true; } } if (anyCellSorted == false) { return; } } } }