Java tutorial
//package com.java2s; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; public class Main { private static void addDummyFile(Path directory, String fileName, int size) throws IOException { byte[] content = new byte[size]; for (int i = 0; i < content.length; i++) { content[i] = (byte) i; } Files.createDirectories(directory); Files.write(directory.resolve(fileName), content); } }