代码如下:
![文件 /byte[] 数据转二进制字符串](/zb_users/upload/auto_pic/158.jpg)
public static void main(String[] args) throws IOException {
String path = "D:/a.jpg";
File file = new File(path);
FileInputStream is=new FileInputStream(file);
byte[] bytes=new byte[is.available()];
StringBuilder sb = new StringBuilder();
is.read(bytes);
is.close();
for (byte aByte : bytes) {// sb.append(aByte);
sb.append(Integer.toBinaryString(aByte));
}
System.out.println(sb);
}
#cmt102