Change the Long.parseLong(hex, 16) to convert the hex string back to long.