Column returning 0

0

I have four columns where three multiply and the fourth column returns the multiplication of the three columns bringing the result .. The problem is that some columns are given values for the other three columns causing my code to return 0 for them. I need it not to return 0 for the columns that are not filled. Is it possible?

Follow the code:

    for (int row = 0; row < jTable1.getRowCount(); row++) {
        int severidade = 0;
        int ocorrencia = 0;
        int deteccao = 0;

        if (jTable1.getValueAt(row, 7) != null && jTable1.getValueAt(row, 7).toString() != "") {
            severidade = Integer.valueOf(jTable1.getValueAt(row, 7).toString());
        }

        if (jTable1.getValueAt(row, 12) != null && jTable1.getValueAt(row, 12).toString() != "") {
            ocorrencia = Integer.valueOf(jTable1.getValueAt(row, 12).toString());
        }

        if (jTable1.getValueAt(row, 14) != null && jTable1.getValueAt(row, 14).toString() != "") {
            deteccao = Integer.valueOf(jTable1.getValueAt(row, 14).toString());
        }
        jTable1.setValueAt(severidade * ocorrencia * deteccao, row, 15);

    }
    
asked by anonymous 18.01.2018 / 11:00

0 answers