Java tutorial
import java.util.Arrays; public class Main { public static void main(String[] args) { int[] i1 = new int[] { 2, 2, 5, 4, 1 }; for (int i : i1) { System.out.print(" " + i); } Arrays.sort(i1); for (int i : i1) { System.out.print(" " + i); } int[] i2 = new int[] { 51, 21, 31, 11, 41 }; Arrays.sort(i2, 1, 4); for (int i : i2) { System.out.print(" " + i); } } }