Java tutorial
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; public class Main { public static final int START_PREFIX_CODE = 0x00000001; public static boolean goToPrefix(final ByteBuffer buffer) { int presudo_prefix = 0xffffffff; while (buffer.hasRemaining()) { presudo_prefix = (presudo_prefix << 8) | (buffer.get() & 0xff); if (presudo_prefix == START_PREFIX_CODE) { return true; } } return false; } }