import java.util.Date;
public class PrintfExamples {
public static void main(String[] args) {
//hex value is b5151397, B5151397
System.out.printf("hex value is %1$h, %1$H\n", new Date() );
//hex value
System.out.printf("hex value is %1$h, %1$H\n", 0xCAFE );
//hex value
System.out.printf("hex value is %1$x, %1$X\n", 0xCAFE );
System.out.printf("hex value is %1$#x, %1$#X\n", 0xCAFE );
}
}
/*hex value is 5a341926, 5A341926
hex value is cafe, CAFE
hex value is cafe, CAFE
hex value is 0xcafe, 0XCAFE*/