public static boolean isPerfectSquare2(long n) {
		long lastDigit = n % 10;

		if (lastDigit != 0 && lastDigit != 1 && lastDigit != 4 && lastDigit != 5 && lastDigit != 6 && lastDigit != 9) {
			return false;
		}

		long high = n/2;
		long low = 0;
		
		while (low < high) {
			long mid = (low + high )/ 2;
			long square = mid * mid;

			if (square == n) {
				return true;
			}
			
			if (square < n) {
				low  = mid + 1;
			} else {
				high = mid - 1;
			}
		}
		return false;
	}