Java- SwingWorker when downloading a file from a url the file size isent correct
<p>When I run the program it downloads the files but only 558kb of each file. I have tried different ways of downloading the file but each ends up with the same result. I have also looked to see if the was a max file size but I couldn't find anything about that anywhere.</p>

<pre><code>public class Test2 {

    public static void main(String args[]) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                go();
            }
        });
    }

    public static void go() {
        JFrame frame = new JFrame();
        JPanel panel = new JPanel();
        JLabel label = new JLabel("Loading...");
        JProgressBar jpb = new JProgressBar();
        jpb.setIndeterminate(true);
        panel.add(label);
        panel.add(jpb);
        frame.add(panel);
        frame.pack();
        frame.setSize(200,90);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        new Task_StringUpdate(label).execute();
    }

    static class Task_StringUpdate extends SwingWorker&lt;Void, String&gt; {

        JLabel jlabel;
        public Task_StringUpdate(JLabel jlabel) {
            this.jlabel = jlabel;
        }

        @Override
        protected void process(List&lt;String&gt; chunks) {
            jlabel.setText(chunks.get(chunks.size()-1)); // The last value in this array is all we care about.
            System.out.println(chunks.get(chunks.size()-1));
        }

        @Override
        protected Void doInBackground() throws Exception {
            publish("Downloading Eclipse");
            downloadFile("eclipse-inst-win64.exe","https://www.dropbox.com/s/arw6n2l7w88hnp8/eclipse-inst-win64.exe?dl=0");

            publish("Downloading Firefox");
            downloadFile("Firefox.exe","https://www.dropbox.com/s/arj1j3f4u4c3a6x/Firefox.exe?dl=0");

            publish("Downloading Minecraft");
            downloadFile("MinecraftInstaller.msi","https://www.dropbox.com/s/k08cned13n2otd7/MinecraftInstaller.msi?dl=0");

            publish("Downloading Notepad++");
            downloadFile("npp.7.2.2.Installer.exe","https://www.dropbox.com/s/5b4iqs66f24vatz/npp.7.2.2.Installer.exe?dl=0");

            publish("Downloading OBS");
            downloadFile("OBS-Studio-0.16.6-Full-Installer.exe","https://www.dropbox.com/s/6qdt8241nhx8u0n/OBS-Studio-0.16.6-Full-Installer.exe?dl=0");

            publish("Downloading Paint.net");
            downloadFile("PaintdotnetInstaller.exe","https://www.dropbox.com/s/y4hm9vgcp51f3bx/PaintdotnetInstaller.exe?dl=0");

            publish("Downloading Steam");
            downloadFile("SteamSetup.exe","https://www.dropbox.com/s/i3i34zbwqs0k6wd/SteamSetup.exe?dl=0");

            publish("Downloading VisualStudio and Xamarin");
            downloadFile("vstoolsforxamarin.exe","https://www.dropbox.com/s/55sy203qq3axe84/vstoolsforxamarin.exe?dl=0");


            return null;
        }

        @Override
        protected void done() {
            try {
                get();
                JOptionPane.showMessageDialog(jlabel.getParent(), "Success", "Success", JOptionPane.INFORMATION_MESSAGE);
            } catch (ExecutionException | InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
    public static void downloadFile(String fileName, String fileUrl)  
            throws MalformedURLException, IOException {

        BufferedInputStream inStream = null;  
        FileOutputStream outStream = null;  
        try {  
            URL fileUrlObj=new URL(fileUrl);  
            inStream = new BufferedInputStream(fileUrlObj.openStream());  
            outStream = new FileOutputStream(fileName);  

            byte data[] = new byte[1024];  
            int count;  
            while ((count = inStream.read(data, 0, 1024)) != -1) {  
                outStream.write(data, 0, count);  
            }  
        } finally {  
            if (inStream != null)  
                inStream.close();  
            if (outStream != null)  
                outStream.close();  
        }  
   }
}
</code></pre>