boolean (boolean ignoreCase, int toffset, String other, int ooffset, int len) { if (toffset < 0 || ooffset < 0 || toffset + len > count || ooffset + len > other.count) return false; toffset += offset; ooffset += other.offset; while (--len >= 0) { char c1 = value[toffset++]; char c2 = other.value[ooffset++]; // Note that checking c1 != c2 is redundant when ignoreCase is true, // but it avoids method calls. if (c1 != c2 && (! ignoreCase || (Character.toLowerCase(c1) != Character.toLowerCase(c2) && (Character.toUpperCase(c1) != Character.toUpperCase(c2))))) return false; } return true; }