Here you can find the source of lastIndexOf(final char[] source, final int start, final int end, final char ch)
public static final int lastIndexOf(final char[] source, final int start, final int end, final char ch)
//package com.java2s; //License from project: Apache License public class Main { public static final int lastIndexOf(final char[] source, final int start, final int end, final char ch) { assert source != null; for (int i = end - 1; i >= start; i--) { if (equalsIgnoreCase(source[i], ch)) { return i; }// w ww. j a va 2 s .com } return -1; } private static boolean equalsIgnoreCase(final char a, final char b) { if (a == b) { return true; } final char u1 = Character.toUpperCase(a); final char u2 = Character.toUpperCase(b); return u1 == u2; } public static boolean equalsIgnoreCase(final char[] source, final int sourceOffset, final char[] target, final int targetOffset, final int length) { if (length == 0) { return true; } for (int i = 0; i < length; i++) { if (!equalsIgnoreCase(source[sourceOffset + i], target[targetOffset + i])) { return false; } } return true; } public static boolean equalsIgnoreCase(final String source, final int sourceOffset, final char[] target, final int targetOffset, final int length) { if (length == 0) { return true; } for (int i = 0; i < length; i++) { if (!equalsIgnoreCase(source.charAt(sourceOffset + i), target[targetOffset + i])) { return false; } } return true; } public static boolean equalsIgnoreCase(final String s1, final String s2) { if (s1 == null) { return s2 == null; } return s1.equalsIgnoreCase(s2); } public static char toUpperCase(final char ch) { // TODO optimize return Character.toUpperCase(ch); } }