Here you can find the source of StartsWith(String str, String prefix)
public static boolean StartsWith(String str, String prefix)
//package com.java2s; public class Main { public static boolean StartsWith(String str, String prefix) { if (str == null) { throw new NullPointerException("str"); }/*from w w w . j a va 2s . c om*/ if (prefix == null) { throw new NullPointerException("prefix"); } return (prefix.length() >= str.length()) && str.substring(0, prefix.length()).equals(prefix); } }