private void ComputeHashActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ComputeHashActionPerformed
        try {
            File spath = new File(jComboBox2.getSelectedItem().toString());
            long diskSize = spath.getTotalSpace();
            System.out.println("Disk size: " + diskSize + " or " + Utils.getSize(diskSize));
            System.out.println("Disk : "+spath.getAbsolutePath() + " or " + spath.getCanonicalPath());
            final int size=10485760;  //5242880
            
            ButtonModel algorithm = HashAlgorithm.getSelection();
            final String algo = algorithm.getActionCommand();

            final int stop = (int) (diskSize/size);
            final int extra = (int) (diskSize%size);
            HashProgressBar.setMaximum(stop);
            HashProgressBar.setMinimum(0);
            HashProgressBar.setStringPainted(true);
            System.out.println("extra "+extra);
            System.out.println("Stop: "+stop);
            Thread thread = new Thread(new Runnable() {

                                @Override
                                public void run() {
                                    try {
                                        StringBuilder hashString = new StringBuilder();
                                                                MessageDigest m = null;
                                                        byte[] content = new byte[size];
                                                                    try {
                                                            m = MessageDigest.getInstance(algo);
                                                        } catch (NoSuchAlgorithmException ex) {
                                                            Logger.getLogger(MainJFrame.class.getName()).log(Level.SEVERE, null, ex);
                                                        }
                                                        File sxpath = new File("\\\\.\\" + jComboBox2.getSelectedItem().toString());
                                                        
                                                            RandomAccessFile diskAccess1 = new RandomAccessFile(sxpath, "r");
                                                        
                                                        m.reset();
                                                                for(int i=0;i<stop;i++)
                                                        {
                                                            HashProgressBar.setValue(i);
                                                            diskAccess1.readFully(content);
                                                            m.update(content);
                                                            byte[] digest = m.digest(content);
                                                            BigInteger bigInt = new BigInteger(1,digest);
                                                            hashString = hashString.append(bigInt.toString(16));
                                                        }
                                                        content = new byte[extra];
                                                        m.update(content);
                                                            byte[] digest = m.digest(content);
                                                            BigInteger bigInt = new BigInteger(1,digest);
                                                            hashString = hashString.append(bigInt.toString(16));
                                                            HashProgressBar.setValue(stop);
                                                         //   System.out.println("reached end");
                                                        m.update(String.valueOf(hashString).getBytes());
                                                        digest = m.digest(String.valueOf(hashString).getBytes());
                                                        bigInt = new BigInteger(1,digest);
                                                            HashValue.setText(bigInt.toString(16));
                                                            HashProgressBar.setString("Completed Hashing");
                                    } catch (FileNotFoundException ex) {
                                        Logger.getLogger(MainJFrame.class.getName()).log(Level.SEVERE, null, ex);
                                    } catch (IOException ex) {
                                        Logger.getLogger(MainJFrame.class.getName()).log(Level.SEVERE, null, ex);
                                    }
                                }
                            });
            thread.start();
        } catch (IOException ex) {
            Logger.getLogger(MainJFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_ComputeHashActionPerformed