Sort array values in case insensitive order
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
String[] teams = new String[5];
teams[0] = "M";
teams[1] = "c";
teams[2] = "A";
teams[3] = "l";
teams[4] = "E";
Arrays.sort(teams);
System.out.println(Arrays.toString(teams));
Arrays.sort(teams, String.CASE_INSENSITIVE_ORDER);
System.out.println(Arrays.toString(teams));
}
}
Related examples in the same category