Quickly fill a large file with integer value -1

0

The following very quickly creates large files filled with zeros. (This sample is in Scala but only the Java API is used)

val f = new File(dir, fileName)
val raf = new RandomAccessFile(f, "rw")
raf.setLength(8 * math.pow(math.pow(2, 16), 2).toLong)
raf.close()

What is a quick way to fill the file with the integer value -1 (0xffffffff)?

java
java-io
asked on Stack Overflow Aug 15, 2018 by Synesso

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0