Here you can find the source of binarySearchStringArray(String[] array, String item, int first, int last)
public static int binarySearchStringArray(String[] array, String item, int first, int last)
//package com.java2s; //License from project: Open Source License public class Main { public static int binarySearchStringArray(String[] array, String item, int first, int last) { if (last < first) { return -1; }/*from w w w .j a va 2 s. c o m*/ int mid = (first + last) / 2; if (array[mid].equals(item)) { return mid; } if (item.compareTo(array[mid]) < 0) { return binarySearchStringArray(array, item, first, mid - 1); } else { return binarySearchStringArray(array, item, mid + 1, last); } } }