Java Array Find getIndex(double income, String[] scopes)

Here you can find the source of getIndex(double income, String[] scopes)

Description

get Index

License

LGPL

Declaration

public static int getIndex(double income, String[] scopes) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.util.Arrays;

public class Main {
    public static int getIndex(double income, String[] scopes) {
        int len = scopes.length;
        len++;//w  w  w . j  av  a2s .  c  o m
        double[] vals = new double[len];
        vals[0] = income;
        for (int i = 1; i < len; i++) {
            vals[i] = Long.parseLong(scopes[i - 1]);
        }
        Arrays.sort(vals);
        return (Arrays.binarySearch(vals, income));
    }
}

Related

  1. findAll(int[] arr1, int[] arr2)
  2. findAllArgumentPermutations(Object[][] allArguments)
  3. findAllOrientations(int[][] matrix)
  4. getIndex(String[] array, String value)
  5. getIndexObject(Object[] data, Object object)
  6. getIndexOf(int i, int[] array)