How can I convert a file with an .exe extension to an array of bytes using java? I have tried with the following code, but it only works for text files.
File soft = jcf.getSelectedFile();
FileInputStream fis = new FileInputStream(soft);
archivoBytes = new byte[(int) soft.length()];
BufferedInputStream bis = new BufferedInputStream(fis);
int leidos;
while ((leidos = bis.read(b)) > 0) {
bis.read(archivoBytes, 0, leidos);
}
bis.close();
What am I doing wrong? Is there any other method for conversion?