Here you can find the source of sort(final int[] data)
public static int[] sort(final int[] data)
//package com.java2s; //License from project: Open Source License import java.util.Arrays; public class Main { public static int[] sort(final int[] data) { return sort(data, true); }/* www . ja va 2 s .com*/ public static int[] sort(final int[] data, boolean ascending) { int[] sortedData = data.clone(); Arrays.sort(sortedData); if (!ascending) { sortedData = reverse(sortedData); } return sortedData; } public static double[] sort(final double[] data) { return sort(data, true); } public static double[] sort(final double[] data, boolean ascending) { double[] sortedData = data.clone(); Arrays.sort(sortedData); if (!ascending) { sortedData = reverse(sortedData); } return sortedData; } public static int[] reverse(final int[] data) { int[] reverseData = new int[data.length]; for (int i = 0, j = data.length - 1; i < data.length; i++, j--) { reverseData[i] = data[j]; } return reverseData; } public static double[] reverse(final double[] data) { double[] reverseData = new double[data.length]; for (int i = 0, j = data.length - 1; i < data.length; i++, j--) { reverseData[i] = data[j]; } return reverseData; } }