Java tutorial
//package com.java2s; import android.util.Log; public class Main { public static short hasAFEndIndex(byte[] data) { short count = 0; for (int i = 0; i < data.length; i++) { if (data[i] == (byte) 0xAF) { count++; } } Log.e("BMSUtil", "contain the ending index header (count):" + count); return count; } }