Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        short[] s1 = new short[] { 31, 21, 51, 41, 11 };
        for (short s : s1) {
            System.out.print(" " + s);
        }
        Arrays.sort(s1);
        for (short s : s1) {
            System.out.print(" " + s);
        }

        short[] s2 = new short[] { 5, 2, 3, 1, 4 };
        Arrays.sort(s2, 1, 4);

        for (short s : s2) {
            System.out.print(" " + s);
        }
    }
}