Here you can find the source of arrayRegionMatches(char[] source, int sourceStart, char[] target, int targetStart, int len)
Parameter | Description |
---|---|
len | the length to compare. The start indices and start+len must be valid. |
public final static boolean arrayRegionMatches(char[] source, int sourceStart, char[] target, int targetStart, int len)
//package com.java2s; /*/* w w w. ja v a 2 s .c om*/ * @(#)Utility.java 1.4 05/11/17 * * Portions Copyright 2006 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ public class Main { /** * Convenience utility to compare two char[]s. * @param len the length to compare. * The start indices and start+len must be valid. */ public final static boolean arrayRegionMatches(char[] source, int sourceStart, char[] target, int targetStart, int len) { int sourceEnd = sourceStart + len; int delta = targetStart - sourceStart; for (int i = sourceStart; i < sourceEnd; i++) { if (source[i] != target[i + delta]) return false; } return true; } }