Java Utililty Methods Array Last Index Of

List of utility methods to do Array Last Index Of

Description

The list of methods to do Array Last Index Of are organized into topic(s).

Method

intlastIndexOfAny(String str, String[] searchStrs)
Find the latest index of any of a set of potential substrings.
if ((str == null) || (searchStrs == null)) {
    return -1;
int sz = searchStrs.length;
int ret = -1;
int tmp = 0;
for (int i = 0; i < sz; i++) {
    tmp = str.lastIndexOf(searchStrs[i]);
...
intlastIndexOfAny(String str, String[] searchStrs)
last Index Of Any
if ((str == null) || (searchStrs == null)) {
    return -1;
int searchStrsLength = searchStrs.length;
int index = -1;
int tmp = 0;
for (int i = 0; i < searchStrsLength; i++) {
    String search = searchStrs[i];
...
intlastIndexOfAny(String str, String[] searchStrs)

Find the latest index of any of a set of potential substrings.

A null String will return -1.

if ((str == null) || (searchStrs == null)) {
    return -1;
int sz = searchStrs.length;
int ret = -1;
int tmp = 0;
for (int i = 0; i < sz; i++) {
    String search = searchStrs[i];
...
intlastIndexOfAny(String string, char[] anyOf)
last Index Of Any
int highestIndex = -1;
for (char c : anyOf) {
    int index = string.lastIndexOf(c);
    if (index > highestIndex) {
        highestIndex = index;
        if (index == string.length() - 1)
            break;
return highestIndex;
intlastIndexOfAnyNoCheck(byte[] values, byte[] array, int index, int length)
last Index Of Any No Check
int j;
for (int i = (index + length - 1); i >= index; i--) {
    byte b = array[i];
    for (j = 0; j < values.length; j++) {
        if (b == values[j])
            return i;
return INVALID_INDEX;
intlastIndexOfArray(int r[], int rpos, int rend, char d[], int dpos)
Get the offset of a last occurance of an int array within a char array.
if (rend < rpos)
    throw new IllegalArgumentException("rend < rpos");
if (rend == rpos)
    return (d.length); 
if ((rend - rpos) == 1) {
    for (int x = d.length - 1; x > dpos; x--)
        if (r[rpos] == d[x])
            return (x);
...
intlastIndexOfChars(String src, char[] chars, int startIndex, int endIndex)
last Index Of Chars
int total = src.length() - 1;
if (total < 0) {
    return -1;
if (startIndex >= total) {
    startIndex = total;
if (endIndex < 0) {
...
intlastIndexOfInsensitive(String o, String[] vals)
last Index Of Insensitive
return lastIndexOfInsensitive(o, vals, 0);
intlastIndexOfNoCheck(byte value, byte[] array, int index, int length)
last Index Of No Check
for (int i = (index + length - 1); i >= index; i--) {
    if (array[i] == value)
        return i;
return INVALID_INDEX;
intlastIndexOfNot(byte[] array, int obj)
last Index Of Not
for (int i = array.length - 1; i >= 0; i--) {
    if (array[i] != obj)
        return i;
return -1;