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) {
        float floatArray[] = { 1.2f, 2.1f, 4.7f, 5.3f };
        Arrays.sort(floatArray);

        float searchValue = 4.7f;
        System.out.println(Arrays.binarySearch(floatArray, searchValue));

        searchValue = 3.3f;
        System.out.println(Arrays.binarySearch(floatArray, searchValue));
    }
}