Groovy web console

subscribe to the feed Subscribe
to this
site
rfid-hex-converter (via #groovywebconsole)
tweet this snippet Tweet
this
script

rfid-hex-converter

Published 9 months ago by Risto
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def rfidInDecimalFormat = '36108717006729732'
def hex = Long.toHexString(Long.parseLong(rfidInDecimalFormat));
if (hex.length() % 2 != 0) {
    hex = "0" + hex;
}
def sb = new StringBuilder();
int i = hex.length();
while (i > 0) {
    sb.append(hex, i - 2, i);
    i = i - 2;
}
sb.toString().toUpperCase();