Here you can find the source of indexOf(ByteBuffer buf, byte b)
public static int indexOf(ByteBuffer buf, byte b)
//package com.java2s; //License from project: Apache License import java.nio.ByteBuffer; public class Main { public static int indexOf(ByteBuffer buf, byte b) { for (int i = 0; i < buf.remaining(); i++) { if (buf.get(buf.position() + i) == b) { return i; }/*from w w w .j a v a 2s. com*/ } return -1; } }