Here you can find the source of bubblesortList(String[][] SortList)
public static String[][] bubblesortList(String[][] SortList)
//package com.java2s; /************************************************************************* * /*ww w. j a va2s. co m*/ * Copyright 2009 by Giuseppe Castagno beppec56@openoffice.org * * The Contents of this file are made available subject to * the terms of European Union Public License (EUPL) version 1.1 * as published by the European Community. * * This program is free software: you can redistribute it and/or modify * it under the terms of the EUPL. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * EUPL for more details. * * You should have received a copy of the EUPL along with this * program. If not, see: * https://www.osor.eu/eupl, http://ec.europa.eu/idabc/eupl. * ************************************************************************/ public class Main { /** * @author bc93774 This function bubble sorts an array of with 2 dimensions. * The default sorting order is the first dimension Only if * sort2ndValue is True the second dimension is the relevant for the * sorting order */ public static String[][] bubblesortList(String[][] SortList) { String DisplayDummy; int SortCount = SortList[0].length; int DimCount = SortList.length; for (int s = 0; s < SortCount; s++) { for (int t = 0; t < SortCount - s - 1; t++) { if (SortList[0][t].compareTo(SortList[0][t + 1]) > 0) { for (int k = 0; k < DimCount; k++) { DisplayDummy = SortList[k][t]; SortList[k][t] = SortList[k][t + 1]; SortList[k][t + 1] = DisplayDummy; } } } } return SortList; } }