class Utils {

    public static UserToken decrypt(String message) {
        StringTokenizer st = new StringTokenizer(message, "-");
        ArrayList<BigInteger> idPartToDecrypt = new ArrayList<BigInteger>();
        while (st.hasMoreTokens()) {
            String idpart = st.nextToken();
            idPartToDecrypt.add(new BigInteger(idpart));
        }

        List<BigInteger> idPartDecrypted = decryptRSA(idPartToDecrypt);
        StringBuilder sb = new StringBuilder();
        for (BigInteger bigInteger : idPartDecrypted) {
            String aChar = Character.valueOf((char) bigInteger.intValue())
                    .toString();
            sb.append(aChar);
        }
        final String clear = sb.toString();
        final int index1 = clear.indexOf('|');
        final int index2 = clear.indexOf('|', index1 + 1);
        final int index3 = clear.indexOf('|', index2 + 1);
        final String deviceuuid = clear.substring(0, index1);
        final String service = clear.substring(index1 + 1, index2);
        final String user = clear.substring(index2 + 1, index3);
        final String password = clear.substring(index3 + 1);
        return new UserToken(deviceuuid, service, user, password);
    }

}

class UtilsTest {

	static final String TOKEN;
	static final String TOKEN_TO_JSON;

	@Test
	public void testDecrypt() {

		UserToken token = Utils.decrypt(TOKEN);
		assertNotNull(token);
		assertEquals("12345678990", token.getUuid());
		assertEquals("edifice.reception", token.getService());
		assertEquals("aaaa", token.getLogin());
		assertEquals("aaaa", token.getPassword());
	}

}