public boolean compareApproximate(String textToCompare, String sequence, int mismatches) {
        //number of mismatches
        int d = 0;

        //compare characters and increase number of mismatches if necessary
        for (int i = 0; i < textToCompare.length(); i++) {
            Character first = textToCompare.charAt(i);
            Character second = sequence.charAt(i);

            if (!first.equals(second)) {
                d++;
            }
        }

        //check if the number of mismatches if smaller or equal to the target
        //mismatches
        if (d <= mismatches) {
            return true;
        } else {
            return false;
        }
    }