code: public static int countOccurrences( String s, char c )
  	{
  		int count = 0;
  		int index = 0;
  		while( true )
  		{
  			index = s.indexOf( c, index );
  			if( index == -1 )
  			{
  				break;
  			}
  			count++;
  		}
  		return count;
  	}
docs: Counts the number of occurrences of a character in the specified <tt>String</tt>.
  
  @param s   the <tt>String</tt> to analyze.
  @param c   the character to search for.
  
  @return number of occurrences found.