while (message.charAt(messageTypeEnd) != '\001') {
while (messageString.charAt(messageTypeEnd) != '\001') {
    private String getMessageType() throws InvalidMessage {        int messageTypeStart = message.indexOf("35=") + 3;        int messageTypeEnd = messageTypeStart + 1;        while (message.charAt(messageTypeEnd) != '\001') {            messageTypeEnd++;            if (messageTypeEnd >= message.length()) {                throw new InvalidMessage("couldn't extract message type");            }        }        return message.substring(messageTypeStart, messageTypeEnd);    }