static String getCheckCode(String secret) throws GeneralSecurityException,
      DecodingException {
    final byte[] keyBytes = Base32String.decode(secret);
    Mac mac = Mac.getInstance("HMACSHA1");
    mac.init(new SecretKeySpec(keyBytes, ""));
    PasscodeGenerator pcg = new PasscodeGenerator(mac);
    return pcg.generateResponseCode(0L);
  }
Called when the activity is first created.
java/com/google/android/apps/authenticator/otp/CheckCodeActivity.java