GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

No menu could be recovered. Follow the blue links in the page.

This view

  • Original page
  • New address

GeezerVison is showing raw.githubusercontent.com — raw.githubusercontent.com

public class BinarySearch { public static int binarySearch(int arr[], int low, int high, int key) { int mid = (low + high) / 2; while (low <= high) { if (arr[mid] < key) { low = mid + 1; } else if (arr[mid] == key) { return mid; } else { high = mid - 1; } mid = (low + high) / 2; } if (low > high) { return -1; } return -1; } public static void main(String[] args) { int intArray[] = {7, 8, 9}; int key = 8; if (binarySearch(intArray, 0, 5, key) != -1) { System.out.print("searching `"); System.out.print(key); System.out.print("` in the array... it's at index "); System.out.println(binarySearch(intArray, 0, 5, key)); } else { System.out.println("index not found"); } } }
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.