java.math.BigInteger.shortValue()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(138)

本文整理了Java中java.math.BigInteger.shortValue()方法的一些代码示例,展示了BigInteger.shortValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BigInteger.shortValue()方法的具体详情如下:
包路径:java.math.BigInteger
类名称:BigInteger
方法名:shortValue

BigInteger.shortValue介绍

暂无

代码示例

代码示例来源:origin: prestodb/presto

@Override
public short shortValue() { return _value.shortValue(); }

代码示例来源:origin: redisson/redisson

@Override
public short shortValue() { return _value.shortValue(); }

代码示例来源:origin: apache/drill

@Override
public short shortValue() { return _value.shortValue(); }

代码示例来源:origin: hibernate/hibernate-orm

return (X) Short.valueOf( value.shortValue() );

代码示例来源:origin: graphql-java/graphql-java

@Override
  public Short 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(SHORT_MIN) < 0 || value.compareTo(SHORT_MAX) > 0) {
      throw new CoercingParseLiteralException(
          "Expected value to be in the Short range but it was '" + value.toString() + "'"
      );
    }
    return value.shortValue();
  }
});

代码示例来源:origin: apache/hive

fastBigIntegerValueUnscaled(
     fastSignum, fast0, fast1, fast2);
 return bigInteger.remainder(BIG_INTEGER_UNSIGNED_SHORT_MAX_VALUE).shortValue();
} else {
   fastBigIntegerValueUnscaled(
     fastSignum, result0, result1, result2);
 return bigInteger.remainder(BIG_INTEGER_UNSIGNED_SHORT_MAX_VALUE).shortValue();

代码示例来源:origin: org.postgresql/postgresql

public static short toShort(String s) throws SQLException {
 if (s != null) {
  try {
   s = s.trim();
   return Short.parseShort(s);
  } catch (NumberFormatException e) {
   try {
    BigDecimal n = new BigDecimal(s);
    BigInteger i = n.toBigInteger();
    int gt = i.compareTo(SHORTMAX);
    int lt = i.compareTo(SHORTMIN);
    if (gt > 0 || lt < 0) {
     throw new PSQLException(GT.tr("Bad value for type {0} : {1}", "short", s),
       PSQLState.NUMERIC_VALUE_OUT_OF_RANGE);
    }
    return i.shortValue();
   } catch (NumberFormatException ne) {
    throw new PSQLException(GT.tr("Bad value for type {0} : {1}", "short", s),
      PSQLState.NUMERIC_VALUE_OUT_OF_RANGE);
   }
  }
 }
 return 0; // SQL NULL
}

代码示例来源:origin: postgresql/postgresql

PSQLState.NUMERIC_VALUE_OUT_OF_RANGE);
return i.shortValue();

代码示例来源:origin: hector-client/hector

@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)");
 }
}

代码示例来源:origin: davidmoten/rxjava-jdbc

return ((BigInteger) o).floatValue();
} else if (o instanceof BigInteger && cls.isAssignableFrom(Short.class)) {
  return ((BigInteger) o).shortValue();
} else if (o instanceof BigInteger && cls.isAssignableFrom(BigDecimal.class)) {
  return new BigDecimal((BigInteger) o);
  return ((BigDecimal) o).floatValue();
} else if (o instanceof BigDecimal && cls.isAssignableFrom(Short.class)) {
  return ((BigDecimal) o).toBigInteger().shortValue();
} else if (o instanceof BigDecimal && cls.isAssignableFrom(Long.class)) {
  return ((BigDecimal) o).toBigInteger().longValue();

代码示例来源:origin: videlalvaro/clochure

public short shortValue(){
  if(bipart == null)
    return (short) lpart;
  else
    return bipart.shortValue();
}

代码示例来源:origin: org.msgpack/msgpack-core

@Override
public short toShort()
{
  return value.shortValue();
}

代码示例来源:origin: blazegraph/database

@Override
public short shortValue() {
  return value.shortValue();
}

代码示例来源:origin: org.openrdf.sesame/sesame-model

@Override
public short shortValue()
{
  return value.shortValue();
}

代码示例来源:origin: org.msgpack/msgpack-core

@Override
public short toShort()
{
  if (type == Type.BIG_INTEGER) {
    return ((BigInteger) objectValue).shortValue();
  }
  return (short) longValue;
}

代码示例来源:origin: batfish/batfish

private static String asIpv6AddressString(BigInteger ipv6AddressAsBigInteger) {
 BigInteger remainder = ipv6AddressAsBigInteger;
 String[] pieces = new String[8];
 for (int i = 0; i < 8; i++) {
  int mask = (int) remainder.shortValue() & 0xFFFF;
  pieces[7 - i] = String.format("%x", mask);
  remainder = remainder.shiftRight(16);
 }
 return StringUtils.join(pieces, ":");
}

代码示例来源:origin: org.msgpack/msgpack

@Override
public short getShort() {
  if (value.compareTo(SHORT_MAX) > 0 || value.compareTo(SHORT_MIN) < 0) {
    throw new MessageTypeException(); // TODO message
  }
  return value.shortValue();
}

代码示例来源:origin: org.softsmithy.lib/softsmithy-lib-swing

/**
 * Gets the value.
 * @return the value.
 */
public short getShortValue(){
  return getBigIntegerValue().shortValue();
}

代码示例来源:origin: org.msgpack/msgpack-core

@Override
public short asShort()
{
  if (!isInShortRange()) {
    throw new MessageIntegerOverflowException(value);
  }
  return value.shortValue();
}

代码示例来源:origin: openmuc/openiec61850

@Override
void setValueFromMmsDataObj(Data data) throws ServiceError {
  if (data.getUnsigned() == null) {
    throw new ServiceError(ServiceError.TYPE_CONFLICT, "expected type: unsigned");
  }
  value = data.getUnsigned().value.shortValue();
}

相关文章