I'd suggest that you add Apache Commons Lang to your classpath. If you are not able to do so, you can find you own way to solve this issue, it's not too hard but using an existing, well-tested approach is probably better.
A simple solution could look as following:
public static void main(String[] args) {
String bla =" gkjewlgjewl\rgjeklwgjewl\rwgjkewlgew";
System.err.println(bla.split("\r").length - 1);
}
You could also use String's indexOf(int ch) method to find the first occurence and continue with indexOf(int ch, int fromIndex) until you don't find any more and count it up at the end.