Ubuntu Pastebin

Paste from tj at Wed, 21 Oct 2015 12:07:17 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import java.lang.String;
import java.lang.Long;

// 1234567890(decimal) to 100100100101100000001011010010 to 1001000000000000000000000000010000000101101001000000001100101 to 1200000080B48065(hex)

public class NfcRaw {

 public static void
 main(String[] argv)
 {
  if (argv.length > 0) {
   long input = Long.parseLong(argv[0]);
   long nfc_data = 0;
   nfc_data |= (input & 0x00000003) << 32;
   nfc_data |= (input & 0x000003FC) << 64;
   nfc_data |= (input & 0x0003FC00) << 48;
   nfc_data |= (input & 0xFC000000) << 24;
   nfc_data |= (input & 0x03FC0000) << 16;
   System.out.println(Long.toString(nfc_data, 16));
  } else {
    System.out.println("usage: decimal");
  }
 }
}
Download as text