Java tutorial
import java.io.IOException; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.util.ArrayList; public class Main { public static void main(String[] args) { Path ball_path = Paths.get("C:/tutorial/photos", "ball.png"); byte[] ball_bytes = new byte[] { (byte) 0x89, (byte) 0x50, (byte) 0x4e, }; try { Files.write(ball_path, ball_bytes); } catch (IOException e) { System.err.println(e); } } }