public static void downloadOrUpdateInstaller(IMonitor monitor, String host, File dest, boolean update)
    {
        String fileName = "unknow";
        byte[] buffer = new byte[65536];
        try
        {
            URL url = new URL(host);
            URLConnection urlconnection = url.openConnection();

            if((urlconnection instanceof HttpURLConnection))
            {
                urlconnection.setRequestProperty("Cache-Control", "no-cache");
                urlconnection.connect();
            }

            int fileLength = urlconnection.getContentLength();

            if(fileLength == -1)
            {
                JOptionPane.showMessageDialog(null, "Invalide download link, cannot install", Language.getLocalizedString("error"), JOptionPane.ERROR_MESSAGE);
                return;
            }
            monitor.setMaximum(fileLength);

            fileName = url.getFile().substring(url.getFile().lastIndexOf('/') + 1);
            InputStream inputstream = urlconnection.getInputStream();
            if(update)
            {
                fileName = fileName.replace(".jar", "new.jar");
            }
            FileOutputStream fos = new FileOutputStream(dest.toString() + File.separator + fileName);

            long downloadStartTime = System.currentTimeMillis();
            int downloadedAmount = 0;
            int bufferSize;
            int currentSizeDownload = 0;
            while((bufferSize = inputstream.read(buffer, 0, buffer.length)) != -1)
            {
                fos.write(buffer, 0, bufferSize);
                currentSizeDownload += bufferSize;
                monitor.setProgress(currentSizeDownload);

                downloadedAmount += bufferSize;
                long timeLapse = System.currentTimeMillis() - downloadStartTime;

                if(timeLapse >= 1000L)
                {
                    float downloadSpeed = downloadedAmount / (float)timeLapse;
                    downloadSpeed = (int)(downloadSpeed * 100.0F) / 100.0F;
                    downloadedAmount = 0;
                    downloadStartTime += 1000L;

                    if(downloadSpeed > 1000F)
                    {
                        DecimalFormat df = new DecimalFormat();
                        df.setMaximumFractionDigits(2);
                        monitor.setNote("Download " + fileName + " at " + String.valueOf(df.format(downloadSpeed / 1000)) + " mo/s");
                    }
                    else
                    {
                        monitor.setNote("Download " + fileName + " at " + String.valueOf(downloadSpeed) + " ko/s");
                    }
                }
            }
            inputstream.close();
            fos.close();
        }
        catch(IOException e)
        {
            JOptionPane.showMessageDialog(null, "Error while trying to download " + fileName, Language.getLocalizedString("error"), JOptionPane.ERROR_MESSAGE);
            e.printStackTrace();
        }
    }