Get your own Java server
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;

public class Main {
  public static void main(String[] args) throws IOException {
    FileOutputStream output = new FileOutputStream("filename.txt");
    output.write("Hello World".getBytes());
    FileChannel channel = output.getChannel();
    System.out.println(channel.size());
    output.close();
  }
}

              
11