Here you can find the source of sort(int[] intValues)
public static void sort(int[] intValues)
//package com.java2s; /******************************************************************************* * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * //from w w w .j a v a 2s .c o m * Contributors: * Nokia Corporation - initial implementation *******************************************************************************/ public class Main { public static void sort(int[] intValues) { int idxs[] = intValues; int length = idxs.length; for (int gap = length / 2; gap > 0; gap /= 2) { for (int i = gap; i < length; i++) { for (int j = i - gap; j >= 0; j -= gap) { if (idxs[j] > idxs[j + gap]) { int swap = idxs[j]; idxs[j] = idxs[j + gap]; idxs[j + gap] = swap; } } } } } }