1 Star 0 Fork 0

BESTI.IS.JAVA2018/20165305zhenlong

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
MyOD.java 1.03 KB
Copy Edit Raw Blame History
20165305suzhenlong authored 7 years ago . finished MyOD program
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
public class MyOD {
public static String format(byte []bt){
int line=0 ;
StringBuilder buf=new StringBuilder() ;
for(byte d:bt){
if(line%16==0)
buf.append(String.format("%05x: ", line)) ;
buf.append(String.format("%02x ", d)) ;
line++ ;
if(line%16==0)
buf.append("\n");
}
// buf.append("\n") ;
return buf.toString();
}
public static byte[] readFile(String file) throws IOException{
InputStream is=new FileInputStream(file) ;
int length=is.available() ;
byte bt[]=new byte[length] ;
is.read(bt) ;
return bt;
}
public static void main(String[]agrs) throws IOException{
byte []bt=MyOD.readFile("C:\\Users\\23321\\20165305zhenlong\\java\\123.txt");
//String hexData=MyOD.format(bt) ;
System.out.println(MyOD.format(bt));
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/BESTI-IS-JAVA-2018/20165305zhenlong.git
git@gitee.com:BESTI-IS-JAVA-2018/20165305zhenlong.git
BESTI-IS-JAVA-2018
20165305zhenlong
20165305zhenlong
master

Search