code: public static final boolean parseBoolean(CharSequence cs, int radix, int beginIndex, int endIndex)
      {
          if (radix != 2)
          {
              throw new IllegalArgumentException("radix must be 2");
          }
          if (Character.codePointCount(cs, beginIndex, endIndex) != 1)
          {
              throw new IllegalArgumentException("input length must be 1");
          }
          int digit = Character.digit(Character.codePointAt(cs, beginIndex), 2);
          switch (digit)
          {
              case 1:
                  return true;
              case 0:
                  return false;
              default:
                  throw new IllegalArgumentException("input must be 0/1");
          }
      }
docs: Parses the char sequence argument as a boolean. The boolean returned represents
  the value true if the char sequence argument is not null and it's digit value
  is 1.
  @param cs
  @param radix Must be 2.
  @param beginIndex the index to the first char of the text range.
  @param endIndex the index after the last char of the text range.
  @return
  @throws IllegalArgumentException radix != 2 or if code point count != 1
  or if input digit is not 0/1.
  @see java.lang.Character#digit(int, int)
  @see java.lang.Character#codePointCount(java.lang.CharSequence, int, int)