/** * remove an existing abstractNum * * @param abstractNumID * @return true if abstractNum with abstractNumID exists in NumberingArray, * false if abstractNum with abstractNumID not exists */ public boolean removeAbstractNum(BigInteger abstractNumID) { if (abstractNumID.byteValue() < abstractNums.size()) { ctNumbering.removeAbstractNum(abstractNumID.byteValue()); abstractNums.remove(abstractNumID.byteValue()); return true; } return false; }
return (X) Byte.valueOf( value.byteValue() );
@Override public Byte parseLiteral(Object input) { if (!(input instanceof IntValue)) { throw new CoercingParseLiteralException( "Expected AST type 'IntValue' but was '" + typeName(input) + "'." ); } BigInteger value = ((IntValue) input).getValue(); if (value.compareTo(BYTE_MIN) < 0 || value.compareTo(BYTE_MAX) > 0) { throw new CoercingParseLiteralException( "Expected value to be in the Byte range but it was '" + value.toString() + "'" ); } return value.byteValue(); } });
private void parse(byte[] bytes) { List<RLPElement> wrapper = RLP.unwrapList(bytes); byte[] blockBytes = wrapper.get(0).getRLPData(); byte[] importFailedBytes = wrapper.get(1).getRLPData(); byte[] receivedAtBytes = wrapper.get(2).getRLPData(); byte[] newBlockBytes = wrapper.get(3).getRLPData(); this.block = new Block(blockBytes); this.importFailedAt = ByteUtil.byteArrayToLong(importFailedBytes); this.receivedAt = ByteUtil.byteArrayToLong(receivedAtBytes); byte newBlock = newBlockBytes == null ? 0 : new BigInteger(1, newBlockBytes).byteValue(); this.newBlock = newBlock == 1; this.nodeId = wrapper.get(4).getRLPData(); }
PSQLState.NUMERIC_VALUE_OUT_OF_RANGE); return i.byteValue();
@Test void testIntToBigInteger() { int[] array = new int[] {7,3,1}; Object result = typeConverterManager.convertType(array, BigInteger[].class); assertNotNull(result); BigInteger[] bigIntegers = (BigInteger[]) result; assertEquals(7, bigIntegers[0].byteValue()); assertEquals(3, bigIntegers[1].byteValue()); assertEquals(1, bigIntegers[2].byteValue()); }
PSQLState.NUMERIC_VALUE_OUT_OF_RANGE); return i.byteValue(); } catch (NumberFormatException ex) { throw new PSQLException(GT.tr("Bad value for type {0} : {1}", "byte", s),
private HSSFColor buildHSSFColor(HSSFWorkbook wb,String colorStr){ String[] color=colorStr.split(","); HSSFPalette palette=wb.getCustomPalette(); byte r=BigInteger.valueOf(Integer.valueOf(color[0])).byteValue(); byte g=BigInteger.valueOf(Integer.valueOf(color[1])).byteValue(); byte b=BigInteger.valueOf(Integer.valueOf(color[2])).byteValue(); HSSFColor targetColor=palette.findColor(r,g,b); if(targetColor==null){ palette.setColorAtIndex(HSSFColorPredefined.LAVENDER.getIndex(), r, g,b); targetColor=palette.getColor(HSSFColorPredefined.LAVENDER.getIndex()); } return targetColor; }
@Override public Object convertCassTypeToObjType(PropertyMappingDefinition md, byte[] value) { BigInteger bigInt = new BigInteger(value); // determine our target integer type and then go from there on the // conversion method Class<?> targetClass = md.getPropDesc().getPropertyType(); if (targetClass.equals(Integer.class) || targetClass.equals(int.class)) { return Integer.valueOf(bigInt.intValue()); } else if (targetClass.equals(Long.class) || targetClass.equals(long.class)) { return Long.valueOf(bigInt.longValue()); } else if (targetClass.equals(Short.class) || targetClass.equals(short.class)) { return Short.valueOf(bigInt.shortValue()); } else if (targetClass.equals(Byte.class) || targetClass.equals(byte.class)) { return Byte.valueOf(bigInt.byteValue()); } else if (targetClass.equals(BigInteger.class)) { return bigInt; } else { throw new HectorObjectMapperException("Column, " + md.getColName() + ", cannot be converted using " + getClass().getSimpleName() + " because POJO property, " + md.getPropDesc().getName() + ", of type " + md.getPropDesc().getPropertyType().getName() + " is not an integer type (in a mathematical context)"); } }
public static ECPoint scalarMult(ECPoint p, BigInteger kin, EllipticCurve curve) { ECPoint r = ECPoint.POINT_INFINITY; BigInteger prime = ((ECFieldFp) curve.getField()).getP(); BigInteger k = kin.mod(prime); int length = k.bitLength(); byte[] binarray = new byte[length]; for (int i = 0; i <= length-1; i++) { binarray[i] = k.mod(TWO).byteValue(); k = k.divide(TWO); } for (int i = length-1; i >= 0; i--) { // i should start at length-1 not -2 because the MSB of binarry may not be 1 r = doublePoint(r, curve); if (binarray[i] == 1) r = addPoint(r, p, curve); } return r; }
if (logger.isInfoEnabled()) hint = word1 + " " + word2.value(); DataWord extendResult = word2.signExtend(k.byteValue()); program.stackPush(extendResult);
public byte byteValue(){ if(bipart == null) return (byte) lpart; else return bipart.byteValue(); }
@Override public byte byteValue() { return value.byteValue(); }
@Override public byte byteValue() { return value.byteValue(); }
public byte[] getBytes() { int[] items = this.items; byte[] bytes = new byte[this.length]; for (int i = 0; i < bytes.length; i++) { bytes[i] = BigInteger.valueOf(items[i]).byteValue(); } return bytes; }
public byte[] getBytes() { long[] items = this.items; byte[] bytes = new byte[this.length]; for (int i = 0; i < bytes.length; i++) { bytes[i] = BigInteger.valueOf(items[i]).byteValue(); } return bytes; }
public void writeVar(BigInteger v) throws IOException { v = v.and(UNSIGNED_LONG_MAX_VALUE); BigInteger i = BigInteger.valueOf(-128); BigInteger BIX7F = BigInteger.valueOf(0x7f); BigInteger BIX80 = BigInteger.valueOf(0x80); while (!v.and(i).equals(BigInteger.ZERO)) { writeByte(v.and(BIX7F).or(BIX80).byteValue()); v = v.shiftRight(7); } writeByte(v.byteValue()); }
/** Obtiene la referencia de la clave. * @return Referencia de la clave. */ public byte getKeyReference() { return ((CommonKeyAttributes)getClassAttributes()).getReference().getIntegerValue().byteValue(); }