tools.java

来自「j2me实现的移动机器人代码(Java实现)」· Java 代码 · 共 38 行

JAVA
38
字号
/*
 * Created on 2005-5-24
 *
 */
package name.lxm.robot.arch;

import java.util.Formatter;

/**
 * Auxiliary tools for communication and calculation
 * 
 * @author Richard Lee
 */
public class Tools {
    Formatter f = new Formatter();
    Object[] obj = new Object[1];
    
    public Tools()
    {
    }
    
    /**
     * Convert the byte to char for display
     * 
     * @param buf2 the data buffer
     * @param c the length of the data in the buffer
     * @return the string of sequence bytes
     */
    public String convertByte2Char(byte[] buf2, int c) {
        for (int i = 0; i < c; i++) {
            obj[0] = new Byte(buf2[i]);
            f.format("%1$02x ", obj);
        }
        return f.toString().toUpperCase();
    }
    
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?