public static int find(String str) {
        if (str.isEmpty()) {
            return -1;
        } else if (str.charAt(0) == '1') {
            return 0;
        } else if (str.charAt(str.length() - 1) == '0') {
            return -1;
        }
        int low = 0;
        int high = str.length() - 1;
        while (low < high) {
            final int mid = low + (high - low) / 2;
            if (str.charAt(mid) == '0') {
                low = mid + 1;
            } else {
                high = mid;
            }
        }
        return low;
    }