private static String getOriginalPincode(String pin) {
    boolean was6DigitsPincode = true;
    if (pin.length() != 7) {
      was6DigitsPincode = false;
    } else {
      for (int i = 0; i < 7; ++i) {
        if ((i == 3 && pin.charAt(3) != ' ')
            || (i != 3 && !('0' <= pin.charAt(i) && pin.charAt(i) <= '9'))) {
          was6DigitsPincode = false;
        }
      }
    }

    if (!was6DigitsPincode) {
      return pin;
    }

    return pin.replace(" ", "");
  }
This function return the original pin code from the styled pin code, which may has a space in
the middle of the string

@param pin The styled pin code
@return The original pin code with no spaces
javatests/com/google/android/apps/authenticator/AuthenticatorActivityTest.java