package com.candidjava.file; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileReader; import java.nio.file.Files; import java.nio.file.Paths; public class JavaFileToByteArray { public static void main(String[] args) throws Exception { File file = new File("F:/Files/sample.mp3"); FileReader fr = new FileReader(file); int i; while ((i = fr.read()) != -1) { byte b[] = new byte[] { (byte) i }; for (byte temp : b) { System.out.println(temp); } } } }