code: public static int substr_count(final String string, final char character) {
          int count = 0;
          int n = string.length();
          for(int i=0;i<n;i++) {
              if(string.charAt(i)==character) {
                  ++count;
              }
          }
  
          return count;
      }
docs: Count the number of times a character appears in the string.
  
  @param string
  @param character
  @return