public static int getPages(String tabla, List campos, List where, int limite) throws Exception {
        int result = 0;
        String orden = "";
        String cond = "";
        if (limite == 0) {
            limite = 1;
        }
        try {
            if (con != null) {
                Statement stm = con.createStatement();
                

                if (campos != null) {
                    orden += campos.get(0);
                    for (int i = 1; i < campos.size(); i++) {
                        orden += " AND " + campos.get(i);
                    }

                }else{
                    orden = "1=1";
                }
                if (where != null) {
                    cond += where.get(0);
                    for (int i = 1; i < where.size(); i++) {
                        cond += " AND " + where.get(i);
                    }
                  
                }else{
                    cond="id";
                }
                String consulta = "SELECT * FROM " + tabla + " WHERE "+cond+" ORDER BY " + orden;
                ResultSet resultSet = stm.executeQuery(consulta);
                int reg = 0;

                while (resultSet.next()) {
                    reg++;
                }
                result = reg / limite;
                if (reg % limite > 0) {
                    result = (reg / limite) + 1;
                }
            }

        } catch (SQLException ex) {
            result = 0;
            ex.getStackTrace();
            throw new Exception("No va el getPages " + ex.getMessage());
        } finally {
            return result;
        }
    }