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) {

        // initializing unsorted float array
        float fArr[] = { 13.1f, 1.4f, 0.7f, 1.5f, 8.7f };

        System.out.println(Arrays.toString(fArr));

        // sorting array from index 0 to 3
        Arrays.sort(fArr, 0, 3);

        System.out.println(Arrays.toString(fArr));
    }
}