The Java program given below converts a jpeg image into a byte array :
import java.nio.file.Files;
import java.io.File;
import java.util.Arrays;
import java.io.IOException;
class ImageToByte
{
public static void main(String args[])throws IOException
{
File fi = new File("puppy.jpg");
byte[] fileContent = Files.readAllBytes(fi.toPath());
System.out.println(Arrays.toString(fileContent));
}
}
No comments:
Post a Comment