Creates an Identifier backed by a two byte Array (big endian).
@param intValue an integer between 0 and 65535 (inclusive)
@return an Identifier with the specified value
517319
public static Identifier fromInt(int intValue) {
        if (intValue < 0 || intValue > MAX_INTEGER) {
            throw new IllegalArgumentException("Identifiers can only be constructed from integers between 0 and " + MAX_INTEGER + " (inclusive).");
        }

        byte[] newValue = new byte[2];

        newValue[0] = (byte) (intValue >> 8);
        newValue[1] = (byte) (intValue);

        return new Identifier(newValue);
    }
768165
public static Integer toInteger(Object value, Integer defaultValue) {
        try {
            return toInteger(value);
        } catch (Exception e) {
            return defaultValue;
        }
    }
1020062
public static int writeInt(byte[] target, int offset, int value) {
        target[offset] = (byte) (value >>> 24);
        target[offset + 1] = (byte) (value >>> 16);
        target[offset + 2] = (byte) (value >>> 8);
        target[offset + 3] = (byte) value;
        return Integer.BYTES;
    }
295518
public static byte safeIntToByte(int i) {
        if (i > (int)Byte.MAX_VALUE || i < (int) Byte.MIN_VALUE) {
            throw new IllegalStateException("Cannot convert int to byte: " + i);
        }
        return (byte)i;
    }
72775
@Nonnull
  public static BitSet createBitSet (final byte nValue)
  {
    final BitSet ret = new BitSet (CGlobal.BITS_PER_BYTE);
    for (int i = 0; i < CGlobal.BITS_PER_BYTE; ++i)
      ret.set (i, ((nValue >> i) & 1) == 1);
    return ret;
  }
616061
public static CounterId fromInt(int n)
    {
        long lowBits = 0xC000000000000000L | n;
        return new CounterId(ByteBuffer.allocate(16).putLong(0, 0).putLong(8, lowBits));
    }
572995
public static Integer getInteger(String name, Integer defaultValue) {
		return Integer.getInteger(name, defaultValue);
	}
702818
@Pure
	@Inline(value = "$2.valueOf($1.longValue())", imported = {BigInteger.class})
	public static BigInteger toBigInteger(AtomicDouble number) {
		return BigInteger.valueOf(number.longValue());
	}
119062
static long toInt(final byte[] buffer, final int initialOffset) {
        int offset = initialOffset;
        return (buffer[offset] << 24)
                + ((buffer[++offset] & 0xFF) << 16)
                + ((buffer[++offset] & 0xFF) << 8)
                + (buffer[++offset] & 0xFF);
    }
1270066
public int getInteger(String columnName, int defaultValue) {
        int index = getColumnIndex(columnName);
        if (isValidIndex(index)) {
            return getInt(index);
        } else {
            return defaultValue;
        }
    }
1359712
public BEValue bdecodeNumber() throws IOException {
    int c = this.getNextIndicator();
    if (c != 'i') {
      throw new InvalidBEncodingException("Expected 'i', not '" +
              (char) c + "'");
    }
    this.indicator = 0;

    c = this.read();
    if (c == '0') {
      c = this.read();
      if (c == 'e')
        return new BEValue(BigInteger.ZERO);
      else
        throw new InvalidBEncodingException("'e' expected after zero," +
                " not '" + (char) c + "'");
    }

    // We don't support more the 255 char big integers
    char[] chars = new char[256];
    int off = 0;

    if (c == '-') {
      c = this.read();
      if (c == '0')
        throw new InvalidBEncodingException("Negative zero not allowed");
      chars[off] = '-';
      off++;
    }

    if (c < '1' || c > '9')
      throw new InvalidBEncodingException("Invalid Integer start '"
              + (char) c + "'");
    chars[off] = (char) c;
    off++;

    c = this.read();
    int i = c - '0';
    while (i >= 0 && i <= 9) {
      chars[off] = (char) c;
      off++;
      c = read();
      i = c - '0';
    }

    if (c != 'e')
      throw new InvalidBEncodingException("Integer should end with 'e'");

    String s = new String(chars, 0, off);
    return new BEValue(new BigInteger(s));
  }
1355858
public static void longToByteArray(long lValue, byte[] buffer, int nStartIndex) {
	buffer[nStartIndex] = (byte) (lValue >>> 56);
	buffer[nStartIndex + 1] = (byte) ((lValue >>> 48) & 0x0ff);
	buffer[nStartIndex + 2] = (byte) ((lValue >>> 40) & 0x0ff);
	buffer[nStartIndex + 3] = (byte) ((lValue >>> 32) & 0x0ff);
	buffer[nStartIndex + 4] = (byte) ((lValue >>> 24) & 0x0ff);
	buffer[nStartIndex + 5] = (byte) ((lValue >>> 16) & 0x0ff);
	buffer[nStartIndex + 6] = (byte) ((lValue >>> 8) & 0x0ff);
	buffer[nStartIndex + 7] = (byte) lValue;
    }
1157521
public static Integer toInt(Object value, Integer defaultValue) {
		return convert(Integer.class, value, defaultValue);
	}
581103
@Pure
	@Inline(value = "EndianNumbers.parseLELong(Double.doubleToLongBits($1))",
			imported = {EndianNumbers.class})
	public static byte[] parseLEDouble(double value) {
		return parseLELong(Double.doubleToLongBits(value));
    }
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;
    }
465181
public static byte[] intToBytes(int value) {
        byte[] result = new byte[4];
        result[0] = (byte)(value >> 24 & 0xff);
        result[1] = (byte)(value >> 16 & 0xff);
        result[2] = (byte)(value >> 8 & 0xff);
        result[3] = (byte)(value & 0xff);
        return result;
    }
637321
public static byte[] getBytesLittleEndian(long value) {
		byte[] b = new byte[8];
		b[0] = (byte)(value & 0xFF);
		b[1] = (byte)((value >> 8) & 0xFF);
		b[2] = (byte)((value >> 16) & 0xFF);
		b[3] = (byte)((value >> 24) & 0xFF);
		b[4] = (byte)((value >> 32) & 0xFF);
		b[5] = (byte)((value >> 40) & 0xFF);
		b[6] = (byte)((value >> 48) & 0xFF);
		b[7] = (byte)((value >> 56) & 0xFF);
		return b;
	}