Here you can find the source of startsWith(char[] src, char[] find, int startAt)
public static boolean startsWith(char[] src, char[] find, int startAt)
//package com.java2s; /***************************************************************************************** * *** BEGIN LICENSE BLOCK *****//w w w.j a v a 2 s . c o m * * Version: MPL 2.0 * * echocat Jomon, Copyright (c) 2012-2013 echocat * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * *** END LICENSE BLOCK ***** ****************************************************************************************/ public class Main { /** * Test whether 'find' can be found at position 'startPos' in the string 'src'. */ public static boolean startsWith(char[] src, char[] find, int startAt) { int startPos = startAt; boolean result = true; // Check ranges if (src.length < startPos + find.length) { result = false; } else { final int max = find.length; for (int a = 0; a < max && result; a++) { if (src[startPos] != find[a]) { result = false; } startPos++; } } return result; } }