code: private static RLPElement decodeRLPElement(ByteBuffer bb) {
  	RLPElement result=null;
  	byte firstByte = bb.get();
  	int firstByteUnsigned = firstByte & 0xFF;
  
  	if (firstByteUnsigned <= 0x7F) {
  		result=new RLPElement(new byte[] {firstByte},new byte[] {firstByte});
  	} else if ((firstByteUnsigned>=0x80) && (firstByteUnsigned<=0xb7)) {
  		// read indicator
  		byte[] indicator=new byte[]{firstByte};
  		int noOfBytes = firstByteUnsigned - 0x80;
  		// read raw data
  		byte[] rawData = new byte[noOfBytes];
  		if (noOfBytes > 0) {
  			bb.get(rawData);
  		}
  		result=new RLPElement(indicator,rawData);
  	} else if ((firstByteUnsigned>=0xb8) && (firstByteUnsigned<=0xbf)) {
  		// read size of indicator (size of the size)
  		int NoOfBytesSize = firstByteUnsigned-0xb7;
  		byte[] indicator = new byte[NoOfBytesSize+1];
  		indicator[0]=firstByte;
  		bb.get(indicator, 1, NoOfBytesSize);
  		long noOfBytes = convertIndicatorToRLPSize(indicator);
  
  		// read the data
  		byte[] rawData=new byte[(int) noOfBytes];
  		bb.get(rawData);
  		result= new RLPElement(indicator,rawData);
  	} else {
  		result=null;
  	}
  	return result;
  }
docs: /*
  Decodes an RLPElement from the given ByteBuffer
  
  @param bb Bytebuffer containing an RLPElement
  
  @return RLPElement in case the byte stream represents a valid RLPElement, null if not