Code example for ByteArrayOutputStream

Methods: write

0
		intBytes[2] = (byte)value; value>>>=8; 
		intBytes[1] = (byte)value; value>>>=8; 
		intBytes[0] = (byte)value; 
 
		try { 
			stream.write(intBytes); 
		} catch (IOException e) { 
			throw new RuntimeException("You're screwed: IOException writing to a ByteArrayOutputStream"); 
		} 
	} 
 
	/** 
	 * Write a 64 bit integer to the byte array without allocating memory. 
	 * @param value a 64 bit int. 
	 */ 
	private void writeInteger64ToByteArray(long value) { 
		longintBytes[7] = (byte)value; value>>>=8; 
		longintBytes[6] = (byte)value; value>>>=8; 
		longintBytes[5] = (byte)value; value>>>=8; 
		longintBytes[4] = (byte)value; value>>>=8; 
Connect your IDE to all the code out there  Get Codota for Java