This is a Java program that generates a random keyfile (for OTP, for example).package kfgen;import java.io.BufferedOutputStream;import java.io.File;import java.io.FileOutputStream;import java.security.SecureRandom;import java.util.Random;import java.util.Scanner;public class Kfgen {    // At least it's not a magic number.    protected static final int MEGABYTE = 1048576;    public static void main(String[] args) {    System.out.println(Name?\n>);    // choice: Scanner to get filename.    // bos: output stream to write the keyfile    try (final Scanner choice = new Scanner(System.in);        final BufferedOutputStream bos = new BufferedOutputStream(            new FileOutputStream(                new File(choice.next()))        )) {        // Slow prng, but hey, this is cryptography, so ... IANAC        final Random sr = SecureRandom.getInstanceStrong();        System.out.println(Enter size in GB:\n>);        // MultiplyExact to throw ugly exception if too large.        // Dunno if this ever happens.        int bytesize = Math.multiplyExact(choice.nextInt(), 1024);        // Tell how many bytes.        System.out.println(bytesize * MEGABYTE +  bytes!);        // Write all that data in 1 MB chunks        // (otherwise byte[] can't hold that much).        // Given that I'm pseudo-buffering at 1 MB, should I use        // unbuffered fileout?        for (int i = 0; i < bytesize; i++) {        final byte[] rand = new byte[MEGABYTE];        sr.nextBytes(rand);        bos.write(rand);        }    } catch (Exception ex) {        throw new Error(ex); // I don't want to deal with it.    }    }}Please evaluate this for security, coding practice, and efficiency.
Keyfile Generator
java;security;cryptography;file