The problem with this is for write() I cannot pass long for position, it has to be int, its write(byte[],long,int)

Since the index in a byte[] MUST BE an int, you can't possibly have more than an int of data in the byte[] in the first place. Just read from the source file in chunks and write to the destination file in chunks.

Unless the input file size is an exact multiple of the byte[] size, this code will write extra incorrect data in the last block. You should use the count of bytes read to control the number written. Bill