Here you can find the source of sortNames(String[] names)
public static void sortNames(String[] names)
//package com.java2s; //License from project: Apache License import java.util.Arrays; public class Main { public static void sortNames(String[] names) { System.out.print("Names: "); System.out.println(Arrays.toString(names)); String[] sortedNames = Arrays.copyOf(names, names.length); System.out.print("Sorted names:"); Arrays.sort(sortedNames); System.out.println(Arrays.toString(sortedNames)); System.out.println("The initial names array was sorted:" + Arrays.equals(sortedNames, names)); System.out.println("The new index of \"Brad Pitt\":" + Arrays.binarySearch(sortedNames, "Brad Pitt")); }//from ww w. ja va 2 s.c om }