Here you can find the source of getIndex(double income, String[] scopes)
public static int getIndex(double income, String[] scopes)
//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)); } }