Appends a byte if it's not a leading zero.
966367
private static int appendByte(byte[] dst, int offset, long value) {
        if (value == 0) {
            return offset;
        }
        dst[offset] = (byte) value;
        return offset + 1;
    }
1034141
def add_0x(string):
    
    if isinstance(string, bytes):
        string = string.decode('utf-8')
    return '0x' + str(string)
1029061
public static void appendUnpaddedInteger(Appendable appendable, int value) throws IOException {
        if (value < 0) {
            appendable.append('-');
            if (value != Integer.MIN_VALUE) {
                value = -value;
            } else {
                appendable.append("" + -(long)Integer.MIN_VALUE);
                return;
            }
        }
        if (value < 10) {
            appendable.append((char)(value + '0'));
        } else if (value < 100) {
            // Calculate value div/mod by 10 without using two expensive
            // division operations. (2 ^ 27) / 10 = 13421772. Add one to
            // value to correct rounding error.
            int d = ((value + 1) * 13421772) >> 27;
            appendable.append((char) (d + '0'));
            // Append remainder by calculating (value - d * 10).
            appendable.append((char) (value - (d << 3) - (d << 1) + '0'));
        } else {
            appendable.append(Integer.toString(value));
        }
    }
947862
public void append(final byte[][] a)
	{
		if(a == null) throw new NullPointerException();

		for(int k = 0; k < a.length; k++) {
			append(a[k]);
		}
	}
1294414
public static byte[] append(byte[] first, byte[] second) {
        if ((first == null) || (second == null)) return null;
        byte[] output = new byte[first.length + second.length];
        System.arraycopy(first, 0, output, 0, first.length);
        System.arraycopy(second, 0, output, first.length, second.length);
        return output;
    }
529264
public static void append(ByteBuffer to, byte b) {
        int pos = flipToFill(to);
        try {
            to.put(b);
        } finally {
            flipToFlush(to, pos);
        }
    }
697008
public void append(byte[] data, int start, int len) {
        if (len <= 0) {
            return;
        }
        byte[] newData = new byte[len];
        System.arraycopy(data, 0, newData, 0, len);
        append(newData);
    }
21796
public void append(char digit) {
        if (count == digits.length) {
            char[] data = new char[count + 100];
            System.arraycopy(digits, 0, data, 0, count);
            digits = data;
        }
        digits[count++] = digit;
    }
871801
private void writeIntegerNoTag(int value)
		throws IOException
	{
		while(true)
		{
			if((value & ~0x7F) == 0)
			{
				out.write(value);
				break;
			}
			else
			{
				out.write((value & 0x7f) | 0x80);
				value >>>= 7;
			}
		}
	}
279901
public void appendByte(int b) {
        elems = ArrayUtils.ensureCapacity(elems, length);
        elems[length++] = (byte)b;
    }
1206961
def append(self, bs):
        
        # The offset is a hint to make bs easily appendable.
        bs = self._converttobitstring(bs, offset=(self.len + self._offset) % 8)
        self._append(bs)
181268
public int append(String stringValue, boolean nullTerminated) {
        if (stringValue != null)
            append(stringValue.getBytes());
        if (nullTerminated)
            append((byte)0);
        return bytesLength;
    }
114168
static private void encodeBytes(byte previous, byte current, int byteIndex, StringBuilder output) {
        int chunk;
        int offset = byteIndex % 5;
        switch (offset) {
            case 0:
                chunk = ((current & 0xF8) >>> 3);
                output.append(lookupTable.charAt(chunk));
                break;
            case 1:
                chunk = (((previous & 0x07) << 2) | ((current & 0xC0) >>> 6));
                output.append(lookupTable.charAt(chunk));
                chunk = ((current & 0x3E) >>> 1);
                output.append(lookupTable.charAt(chunk));
                break;
            case 2:
                chunk = (((previous & 0x01) << 4) | ((current & 0xF0) >>> 4));
                output.append(lookupTable.charAt(chunk));
                break;
            case 3:
                chunk = (((previous & 0x0F) << 1) | ((current & 0x80) >>> 7));
                output.append(lookupTable.charAt(chunk));
                chunk = ((current & 0x7C) >>> 2);
                output.append(lookupTable.charAt(chunk));
                break;
            case 4:
                chunk = (((previous & 0x03) << 3) | ((current & 0xE0) >>> 5));
                output.append(lookupTable.charAt(chunk));
                chunk = (current & 0x1F);
                output.append(lookupTable.charAt(chunk));
                break;
        }
    }
249182
public static void toHex(byte b, Appendable buf) {
		try {
			int bi = _0XFF & b;
			int c = '0' + (bi / SIXTEEN) % SIXTEEN;
			if (c > '9') {
				c = 'A' + (c - '0' - TEN);
			}
			buf.append((char) c);
			c = '0' + bi % SIXTEEN;
			if (c > '9') {
				c = 'A' + (c - '0' - TEN);
			}
			buf.append((char) c);
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}
1025527
def append_little_endian32(self, unsigned_value):
        
        if not 0 <= unsigned_value <= wire_format.UINT32_MAX:
            raise errors.EncodeError(
                'Unsigned 32-bit out of range: %d' % unsigned_value)
        self.append_raw_bytes(struct.pack(
            wire_format.FORMAT_UINT32_LITTLE_ENDIAN, unsigned_value))
684929
public void appendBytes(byte[] bs, int start, int len) {
        elems = ArrayUtils.ensureCapacity(elems, length + len);
        System.arraycopy(bs, start, elems, length, len);
        length += len;
    }
683937
private static byte[] writeInt(int value) throws IOException {
        byte[] b = new byte[4];

        b[0] = (byte) (value & 0x000000FF);
        b[1] = (byte) ((value & 0x0000FF00) >> 8);
        b[2] = (byte) ((value & 0x00FF0000) >> 16);
        b[3] = (byte) ((value & 0xFF000000) >> 24);

        return b;
    }