public static long getRLPListSize(ByteBuffer bb) {
	long result=-1;
	bb.mark();
	byte detector = bb.get();
	int unsignedDetector=detector & 0xFF;
	if ((unsignedDetector>=0xc0) && (unsignedDetector<=0xf7)) {
		result=unsignedDetector; // small list
	} else
		if ((unsignedDetector>=0xf8) && (unsignedDetector<=0xff)) {
			// the first byte
			// large list
			// read size of indicator (size of the size)
			int noOfBytesSize = unsignedDetector-0xf7;
			byte[] indicator = new byte[noOfBytesSize+1];
			indicator[0]=detector;
			bb.get(indicator, 1, noOfBytesSize);
			result=indicator.length + convertIndicatorToRLPSize(indicator);
		}
	bb.reset();
	return result;	
}
public static long getRLPListSize ( ByteBuffer bb ) { long result = - 1 ; bb . mark ( ) ; byte detector = bb . get ( ) ; int unsignedDetector = detector & 0xFF ; if ( ( unsignedDetector >= 0xc0 ) && ( unsignedDetector <= 0xf7 ) ) { result = unsignedDetector ; } else if ( ( unsignedDetector >= 0xf8 ) && ( unsignedDetector <= 0xff ) ) { int noOfBytesSize = unsignedDetector - 0xf7 ; byte [ ] indicator = new byte [ noOfBytesSize + 1 ] ; indicator [ 0 ] = detector ; bb . get ( indicator , 1 , noOfBytesSize ) ; result = indicator . length + convertIndicatorToRLPSize ( indicator ) ; } bb . reset ( ) ; return result ; }
Determines the size of a RLP list. Note: it does not change the position in the ByteBuffer

@param bb
@return -1 if not an RLP encoded list, otherwise size of list INCLUDING the prefix of the list (e.g. byte that indicates that it is a list and size of list in bytes) in bytes