v2client/src/main/java/com/yubico/client/v2/YubicoClient.java
public static String getPublicId(String otp) {
		if ((otp == null) || (otp.length() < OTP_MIN_LEN)){
			//not a valid OTP format, throw an exception
			throw new IllegalArgumentException("The OTP is too short to be valid");
		}
		
		Integer len = otp.length();

		/* The OTP part is always the last 32 bytes of otp. Whatever is before that
		 * (if anything) is the public ID of the YubiKey. The ID can be set to ''
		 * through personalization.
		 */
		return otp.substring(0, len - 32).toLowerCase();
	}
public static String getPublicId(String otp) {
		if ((otp == null) || (otp.length() < OTP_MIN_LEN)){
			//not a valid OTP format, throw an exception
			throw new IllegalArgumentException("The OTP is too short to be valid");
		}
		
		Integer len = otp.length();

		/* The OTP part is always the last 32 bytes of otp. Whatever is before that
		 * (if anything) is the public ID of the YubiKey. The ID can be set to ''
		 * through personalization.
		 */
		return otp.substring(0, len - 32).toLowerCase();
	}
Extract the public ID of a YubiKey from an OTP it generated.

@param otp	The OTP to extract ID from, in modhex format.

@return string	Public ID of YubiKey that generated otp. Between 0 and 12 lower-case characters.

@throws IllegalArgumentException for arguments that are null or too short to be valid OTP strings.