public static void splitFile(int splitSize, File sourceFile, String targetDirectory, SplitFileDialog cd) throws FileNotFoundException, IOException {

        InputStream inputStream = new FileInputStream(sourceFile);
        long fileSize = sourceFile.length();
        int actu = 1;
        long left = fileSize;
        while (left > 0) {
            String att = "";
            if (actu < 10) {
                att = "00" + actu;
            } else if (actu > 9 && actu < 100) {
                att = "0" + actu;
            } else if (actu > 99) {
                att = actu + "";
            }

            File ff = new File(targetDirectory + System.getProperty("file.separator") + sourceFile.getName() + "." + att);
            cd.getjLabel5().setText(ff.getName());
            if (!ff.exists()) {
                ff.createNewFile();
            }
            OutputStream out = new FileOutputStream(ff);
            byte[] buf = new byte[10000000];
            if (splitSize < 10000000) {
                buf = new byte[splitSize];
            }
            int len;
            long smallleft = splitSize;
            while (smallleft > 0 && (len = inputStream.read(buf)) != -1) {
                smallleft = smallleft - buf.length;
                out.write(buf, 0, len);
            }
            out.flush();
            out.close();
            actu = actu + 1;
            left = left - splitSize;
        }
        inputStream.close();
    }