'read a File in hex byteArray and write part of that array to another File - java android

I have a 200kb file and I have to read it in bytes, and then write part of this byteArray (from index 90000 to 165000) to another file. How can I accomplish this.

File file1 = new File(getExternalStorageDirectory(), "file1.raw"); //the 200kb file
try {
         File.createTempFile("file2", "mp3", getCacheDir()); //empty file that needs to get filled with part of the byte array from file1
        } catch (IOException ignored) {}



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source