Here you can find the source of regionMatches(CharSequence a, int i, CharSequence b, int j, int len)
public static boolean regionMatches(CharSequence a, int i, CharSequence b, int j, int len)
//package com.java2s; //License from project: Apache License public class Main { public static boolean regionMatches(CharSequence a, int i, CharSequence b, int j, int len) { if (i + len > a.length() || j + len > b.length() || i < 0 || j < 0 || len < 0) { return false; }/*from w w w . j ava 2 s . co m*/ while (len-- > 0) { if (a.charAt(i++) != b.charAt(j++)) { return false; } } return true; } }