String path = "g:/iphone4.jpg";
File file = new File(path);
FileInputStream fis = new FileInputStream(file);
byte[] b = new byte[fis.available()];
StringBuilder str = new StringBuilder();//不建议用String
fis.read(b);
for(byte bs:b)
{
str.append(Integer.toBinaryString(bs));//转换为二进制
}
//把字节数组的图片写到另一个地方
File apple= new File("D:/apple.jpg");
FileOutputStream fos = new FileOutputStream(apple);
fos.write(b);
fos.flush();
fos.close();