Fetch the repository succeeded.
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));
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。