Create long value in hexadecimal format starting with 0x in Java
Description
The following code shows how to create long value in hexadecimal format starting with 0x.
Example
/*from w w w .jav a 2 s . c o m*/
public class Main {
public static void main(String[] argv) {
long data[] = { 0, 0x01, 0xff, 0x100, 0xffff, 0xffffff,
0x7fffffff, 0xffffffff };
for (int i=0; i<data.length; i++){
System.out.println("data["+i+"] = " + data[i]);
}
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »