@@ -0,0 +1,802 @@
+import java.text.MessageFormat;%0D%0A%0D%0A/**%0D%0A * %0D%0A */%0D%0A%0D%0A/**%0D%0A * @author qienl%0D%0A *%0D%0A */%0D%0Apublic class FirstBadVersion %7B%0D%0A%0D%0A%09public int firstBadVersion(int n) %7B%0D%0A%09%09return doFind(1, n);%0D%0A%09%7D%0D%0A%0D%0A%09private int doFind(int begin, int end) %7B%0D%0A%09%09int middle = Long.valueOf((Long.valueOf(end) + Long.valueOf(begin)) / 2).intValue();%0D%0A//%09%09System.out.println(MessageFormat.format(%22%5B%7B0%7D, %7B1%7D%5D%5Ct%7B2%7D%22, begin, end, middle));%0D%0A%09%09if (end - begin %3C= 1) %7B%0D%0A%09%09%09return isBadVersion(begin) ? begin : end;%0D%0A%09%09%7D%0D%0A%09%09if (isBadVersion(middle)) %7B%0D%0A%09%09%09return doFind(begin, middle);%0D%0A%09%09%7D else %7B%0D%0A%09%09%09return doFind(middle + 1, end);%0D%0A%09%09%7D%0D%0A%09%7D%0D%0A%0D%0A%09private boolean isBadVersion(int n) %7B%0D%0A%09%09return n %3E= 1702766719;%0D%0A%09%7D%0D%0A%0D%0A%09public static void main(String%5B%5D args) %7B%0D%0A%09%09System.out.println(new FirstBadVersion().firstBadVersion(2126753390));%0D%0A%09%7D%0D%0A%7D%0D%0A

Add FirstBadVersion.java