zoukankan      html  css  js  c++  java
  • java中输出hex bytes

    在java里输出bytes array乍一想好像不难,但是做起来还是小有点学问,没想到也有个printf的方法,挺好用的,不废话看代码:

    public class Test {

        
    /**
         * 
    @param args
         
    */
        
    public static void main(String[] args) {
            
    // TODO Auto-generated method stub
            byte[] buffer = new byte[] 
             {
                    (
    byte)0x00, (byte)0xFE, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00
                    (
    byte)0x01, (byte)0xCC, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00
                    (
    byte)0x02, (byte)0x25, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00
             };
            
            
    for (int i = 0; i < buffer.length; i ++) {
                System.out.printf(
    "0x%02X ", buffer[i]);
            }
        }

    }


  • 相关阅读:
    elasticseacth基础操作--QueryBuilders的使用
    并发编程(八)并发安全
    redis集群 相关
    并发编程(七)线程池
    PMP--综合考试知识点,持续更新中。。。
    常用正则表达式
    测试计划
    ACC(Attribute Component Capability) 即特质,组件,能力
    LockScreen
    Custom Window
  • 原文地址:https://www.cnblogs.com/luoluo/p/769609.html
Copyright © 2011-2022 走看看