code: public static void createFileWithDefault(String filePath, long length) throws IOException {
      Path path = Paths.get(filePath);
      try {
        Files.deleteIfExists(path);
        try (
            RandomAccessFile randomAccessFile = new RandomAccessFile(filePath, "rw");
        ) {
          randomAccessFile.setLength(length);
        }
      } catch (IOException e) {
        throw new IOException("create spares file fail,path:" + filePath + " length:" + length, e);
      }
    }
docs: 使用RandomAccessFile创建指定大小的File