私のプログラムはファイルをバイト配列に読み込みましたが、配列の結果に負の数が多い理由がわかりません。配列の要素の値は 0 から 255 の範囲にあると思います。コードは次のとおりです。
public static void main(String [] args)
{
try
{
File file = new File("C:\\1.mp3");
FileInputStream fis = new FileInputStream(file);
byte[] bytes = new byte[(int)file.length()];
fis.read(bytes);
boolean check = true;
int i = -1;
while(check)
{
i=i+1;
if(bytes[i]<0)
{
check = false;
System.out.println("There is a negative number.");
}
}
}
catch(IOException ex)
{
System.out.println(ex.getMessage());
}
}
お手伝いありがとうございます。