public static int countMatches(String string,char c){
  int n=0;
  for (  char tc : string.toCharArray()) {
    if (c == tc)     n++;
  }
  return n;
}

public static int countMatches ( String string , char c ) { int n = 0 ; for ( char tc : string . toCharArray ( ) ) { if ( c == tc ) n ++ ; } return n ; }
counts the amount of times a certain character is part of a string
