Code example for LinkedList

0
 
import java.util.LinkedList; 
 
public class ByteBuffer { 
 
	LinkedList<Integer> bytes = new LinkedList<Integer>();
 
	public void writeUnsignedByte(int s) {
		bytes.add(s - Byte.MAX_VALUE);
	} 
 
	public void writeUnsignedShort(int s) {
		writeUnsignedByte(s & 0xFF);
		writeUnsignedByte((s >> 8) & 0xFF);
	} 
 
	public void writeShort(short s) {
		writeUnsignedByte(s & 0xFF);
		writeUnsignedByte((s >> 8) & 0xFF);
	}