以下のようにMP3ファイルを変更すると、メモリ不足エラーが発生します。とにかく私は以下の操作をより効率的に行うことができますか(つまり、より少ないメモリを使用して)
public void BacaMP3(){
String a = System.getProperty("user.dir") + "/src/MP3/21.waltz-cut.mp3";
String bitMP3="";
try {
File song = new File(a);
FileInputStream file = new FileInputStream(song);
int input = 0;
System.out.println("Creating file ...");
while (input != -1) {
input = file.read();
count++;
if (input==-1)bitMP3="#";
else{
bitMP3 = Integer.toBinaryString(input);
while(bitMP3.length()<8){
bitMP3="0"+bitMP3;
}
}
area1.append(bitMP3+"\n");
}
System.out.println(count);
file.close();
System.out.println("Done");
} catch (Exception e) {
System.out.println("Error  " + e.toString());
}
}