编程语言
首页 > 编程语言> > JAVA应用

JAVA应用

作者:互联网

JAVA获取GMT(格林威治标准时间)

Date date = new Date();
TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
Calendar cal = Calendar.getInstance(TimeZone.getDefault());
date = cal.getTime();

byte[]数组转16进制hex

    byte[] bytes = {-1, 0, 1, 2, 3 };
    StringBuilder sb = new StringBuilder();
    for (byte b : bytes) {
        sb.append(String.format("%02X ", b));
    }
    System.out.println(sb.toString());
    // prints "FF 00 01 02 03 "

标签:JAVA,StringBuilder,new,应用,sb,Date,TimeZone,byte
来源: https://www.cnblogs.com/xs1987/p/15791694.html