private int calcDiscaunt(int mySum){
        try {
            
            Connection con = db.getConnection();
            Statement statement;
            List<Integer> discountList = new ArrayList<Integer>();
            String query1 ="SELECT amount_sum FROM discounts;";
            statement = con.createStatement();
            ResultSet rs = statement.executeQuery(query1);
            
            while(rs.next()){
                discountList.add(rs.getInt("amount_sum"));
            }
            
            for(int i=1;i<discountList.size()+1;i++){
                if(i!=discountList.size()){
                    if((discountList.get(i-1) <= mySum)&& (mySum < discountList.get(i))){
                        return discountList.get(i-1);
                    } else if(discountList.get(i) > mySum){
                        break;
                    }
                }else if(discountList.size()==i){
                    if(discountList.get(i-1) <= mySum){
                        return discountList.get(i-1);
                    }
                }
            }
            
            return 0;
        } catch (SQLException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }