Here you can find the source of charArrayRegionMatches(char[] value, int startPos, CharSequence toMatch)
public static boolean charArrayRegionMatches(char[] value, int startPos, CharSequence toMatch)
//package com.java2s; //License from project: Apache License public class Main { public static boolean charArrayRegionMatches(char[] value, int startPos, CharSequence toMatch) { int matchLen = toMatch.length(), endPos = startPos + matchLen; if (endPos > value.length) { return false; }// w ww. jav a 2 s. c o m for (int matchIndex = 0, i = startPos; i < endPos; i++, matchIndex++) { if (value[i] != toMatch.charAt(matchIndex)) { return false; } } return true; } }