Java Array Last Index Of lastIndexOf(byte[] pattern, byte[] block)

Here you can find the source of lastIndexOf(byte[] pattern, byte[] block)

Description

last Index Of

License

LGPL

Declaration

public static int lastIndexOf(byte[] pattern, byte[] block) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    public static int lastIndexOf(byte[] pattern, byte[] block) {
        nextPos: for (int i = pattern.length - block.length; i >= 0; i--) {
            for (int j = block.length - 1; j >= 0; j--) {
                if (pattern[j + i] == block[j]) {
                    continue;
                } else {
                    continue nextPos;
                }/*from ww w  .ja  v a  2 s  .c  o m*/
            }
            return i;
        }
        return -1;
    }
}

Related

  1. lastIndexOf(byte value, byte[] array)
  2. lastIndexOf(byte[] array, byte valueToFind)
  3. lastIndexOf(byte[] ary, byte value)
  4. lastIndexOf(byte[] bytes, int pos, int len, byte b)
  5. lastIndexOf(byte[] data, int offset, int length, byte val)
  6. lastIndexOf(byte[] s, char c)
  7. lastIndexOf(byte[] source, byte[] match)
  8. lastIndexOf(char[] toBeFound, char[] array)
  9. lastIndexOf(char[] toBeFound, char[] array)