Here you can find the source of quicksort(String a[], int lo0, int hi0)
private static void quicksort(String a[], int lo0, int hi0)
//package com.java2s; /*//from ww w . ja v a2s. c o m * Copyright (c) 1994 Sun Microsystems, Inc. All Rights Reserved. * * Permission to use, copy, modify, and distribute this software * and its documentation for NON-COMMERCIAL purposes and without * fee is hereby granted provided that this copyright notice * appears in all copies. Please refer to the file "copyright.html" * for further important copyright and licensing information. * * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. */ public class Main { private static void quicksort(String a[], int lo0, int hi0) { int lo = lo0; int hi = hi0; if (lo >= hi) { return; } String mid = a[(lo + hi) / 2]; while (lo < hi) { while (lo < hi && a[lo].compareTo(mid) < 0) { lo++; } while (lo < hi && a[hi].compareTo(mid) > 0) { hi--; } if (lo < hi) { String T = a[lo]; a[lo] = a[hi]; a[hi] = T; } } if (hi < lo) { int T = hi; hi = lo; lo = T; } quicksort(a, lo0, lo); quicksort(a, lo == lo0 ? lo + 1 : lo, hi0); } }