Here you can find the source of lastIndexOf(byte[] pattern, byte[] block)
public static int lastIndexOf(byte[] pattern, byte[] block)
//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; } }