public class Hexspeak {
public String decode
(long ciphertext
) {
while(ciphertext > 0)
{
if(ciphertext % 16 == 0)
ret = 'O' + ret;
else if(ciphertext % 16 == 1)
ret = 'I' + ret;
else if(ciphertext % 16 > 9)
ret = (char)(ciphertext % 16 - 10 + 'A') + ret;
else
return "Error!";
ciphertext /= 16;
}
return ret;
}
}
cHVibGljIGNsYXNzIEhleHNwZWFrIHsKICAgIHB1YmxpYyBTdHJpbmcgZGVjb2RlKGxvbmcgY2lwaGVydGV4dCkKICAgIHsKICAgICAgICBTdHJpbmcgcmV0ID0gIiI7CiAgICAgICAgd2hpbGUoY2lwaGVydGV4dCA+IDApCiAgICAgICAgewogICAgICAgICAgICBpZihjaXBoZXJ0ZXh0ICUgMTYgPT0gMCkKICAgICAgICAgICAgICAgIHJldCA9ICdPJyArIHJldDsKICAgICAgICAgICAgZWxzZSBpZihjaXBoZXJ0ZXh0ICUgMTYgPT0gMSkKICAgICAgICAgICAgICAgIHJldCA9ICdJJyArIHJldDsKICAgICAgICAgICAgZWxzZSBpZihjaXBoZXJ0ZXh0ICUgMTYgPiA5KQogICAgICAgICAgICAgICAgcmV0ID0gKGNoYXIpKGNpcGhlcnRleHQgJSAxNiAtIDEwICsgJ0EnKSArIHJldDsKICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgcmV0dXJuICJFcnJvciEiOwogICAgICAgICAgICBjaXBoZXJ0ZXh0IC89IDE2OwogICAgICAgIH0KICAgICAgICByZXR1cm4gcmV0OwogICAgfQp9Cg==