Here you can find the source of startsWith(String string, char... ca)
public static final boolean startsWith(String string, char... ca)
//package com.java2s; //License from project: LGPL public class Main { public static final boolean startsWith(String string, char... ca) { int l = ca.length; for (int i = 0; i < l; i++) { if (string.charAt(i) != ca[i]) return false; }// w w w . j a v a 2 s .c o m return true; } public static final boolean startsWith(String string, char ca, char cb) { if (string.charAt(0) != ca) return false; if (string.charAt(1) != cb) return false; return true; } public static final boolean startsWith(String string, char ca, char cb, char cc) { if (string.charAt(0) != ca) return false; if (string.charAt(1) != cb) return false; if (string.charAt(1) != cc) return false; return true; } }