java.lang.Integer.shortValue()方法的使用及代码示例

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

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

Integer.shortValue介绍

[英]Returns the value of this Integer as a short.
[中]以短字符串形式返回此整数的值。

代码示例

代码示例来源:origin: goldmansachs/gs-collections

  1. public short shortValueOf(Integer integer)
  2. {
  3. return integer.shortValue();
  4. }
  5. }

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

  1. public Short toShort(Integer self) {
  2. return self.shortValue();
  3. }

代码示例来源:origin: eclipse/eclipse-collections

  1. @Override
  2. public short shortValueOf(Integer integer)
  3. {
  4. return integer.shortValue();
  5. }
  6. }

代码示例来源:origin: eclipse/eclipse-collections

  1. @Override
  2. public short shortValueOf(Integer integer)
  3. {
  4. return integer.shortValue();
  5. }
  6. }

代码示例来源:origin: linlinjava/litemall

  1. public static Short parseShort(String body, String field) {
  2. ObjectMapper mapper = new ObjectMapper();
  3. JsonNode node = null;
  4. try {
  5. node = mapper.readTree(body);
  6. JsonNode leaf = node.get(field);
  7. if (leaf != null) {
  8. Integer value = leaf.asInt();
  9. return value.shortValue();
  10. }
  11. } catch (IOException e) {
  12. e.printStackTrace();
  13. }
  14. return null;
  15. }

代码示例来源:origin: org.apache.poi/poi

  1. @Override
  2. public void setDx2(int dx2) {
  3. _escherClientAnchor.setDx2(Integer.valueOf(dx2).shortValue());
  4. }
  5. }

代码示例来源:origin: drewnoakes/metadata-extractor

  1. @Nullable
  2. public String getPitchAngleDescription()
  3. {
  4. Integer value = _directory.getInteger(TAG_PITCH_ANGLE);
  5. if (value == null)
  6. return null;
  7. DecimalFormat format = new DecimalFormat("0.#");
  8. // converted to degrees of upward camera tilt
  9. return format.format(-value.shortValue() / 10.0);
  10. }

代码示例来源:origin: drewnoakes/metadata-extractor

  1. @Nullable
  2. public String getRollAngleDescription()
  3. {
  4. Integer value = _directory.getInteger(TAG_ROLL_ANGLE);
  5. if (value == null)
  6. return null;
  7. DecimalFormat format = new DecimalFormat("0.#");
  8. // converted to degrees of clockwise camera rotation
  9. return format.format(value.shortValue() / 10.0);
  10. }

代码示例来源:origin: drewnoakes/metadata-extractor

  1. @Nullable
  2. public String getAccelerometerZDescription()
  3. {
  4. Integer value = _directory.getInteger(TAG_ACCELEROMETER_Z);
  5. if (value == null)
  6. return null;
  7. // positive is acceleration upwards
  8. return String.valueOf(value.shortValue());
  9. }

代码示例来源:origin: org.apache.poi/poi

  1. /**
  2. * @param row2 the row(0 based) of the second cell.
  3. */
  4. public void setRow2(int row2) {
  5. checkRange(row2, 0, MAX_ROW, "row2");
  6. _escherClientAnchor.setRow2(Integer.valueOf(row2).shortValue());
  7. }

代码示例来源:origin: drewnoakes/metadata-extractor

  1. @Nullable
  2. public String getAccelerometerXDescription()
  3. {
  4. Integer value = _directory.getInteger(TAG_ACCELEROMETER_X);
  5. if (value == null)
  6. return null;
  7. // positive is acceleration to the left
  8. return String.valueOf(value.shortValue());
  9. }

代码示例来源:origin: org.apache.poi/poi

  1. /**
  2. * @param row1 0-based row of the first cell.
  3. */
  4. public void setRow1(int row1) {
  5. checkRange(row1, 0, MAX_ROW, "row1");
  6. _escherClientAnchor.setRow1(Integer.valueOf(row1).shortValue());
  7. }

代码示例来源:origin: drewnoakes/metadata-extractor

  1. @Nullable
  2. public String getAccelerometerYDescription()
  3. {
  4. Integer value = _directory.getInteger(TAG_ACCELEROMETER_Y);
  5. if (value == null)
  6. return null;
  7. // positive is acceleration backwards
  8. return String.valueOf(value.shortValue());
  9. }

代码示例来源:origin: eclipse-vertx/vert.x

  1. public StreamPriority(JsonObject json) {
  2. this.weight = json.getInteger("weight", (int)DEFAULT_WEIGHT).shortValue();
  3. this.dependency = json.getInteger("dependency", DEFAULT_DEPENDENCY);
  4. this.exclusive = json.getBoolean("exclusive", DEFAULT_EXCLUSIVE);
  5. }

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

  1. public short getShort(int parameterIndex) throws SQLException {
  2. checkClosed();
  3. checkIndex(parameterIndex, Types.SMALLINT, "Short");
  4. if (callResult[parameterIndex - 1] == null) {
  5. return 0;
  6. }
  7. return ((Integer) callResult[parameterIndex - 1]).shortValue();
  8. }

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

  1. @Override
  2. protected Short[] getSortedTestData() {
  3. Random rnd = new Random(874597969123412338L);
  4. short rndShort = Integer.valueOf(rnd.nextInt()).shortValue();
  5. if (rndShort < 0) {
  6. rndShort = Integer.valueOf(-rndShort).shortValue();
  7. }
  8. if (rndShort == Short.MAX_VALUE) {
  9. rndShort -= 3;
  10. }
  11. if (rndShort <= 2) {
  12. rndShort += 3;
  13. }
  14. return new Short[]{
  15. Short.valueOf(Short.MIN_VALUE),
  16. Short.valueOf(Integer.valueOf(-rndShort).shortValue()),
  17. Short.valueOf(Integer.valueOf(-1).shortValue()),
  18. Short.valueOf(Integer.valueOf(0).shortValue()),
  19. Short.valueOf(Integer.valueOf(1).shortValue()),
  20. Short.valueOf(Integer.valueOf(2).shortValue()),
  21. Short.valueOf(Integer.valueOf(rndShort).shortValue()),
  22. Short.valueOf(Short.MAX_VALUE)};
  23. }
  24. }

代码示例来源:origin: drewnoakes/metadata-extractor

  1. @Nullable
  2. public String getWbTypeDescription(int tagType)
  3. {
  4. Integer wbtype = _directory.getInteger(tagType);
  5. if (wbtype == null)
  6. return null;
  7. return super.getLightSourceDescription(wbtype.shortValue());
  8. }

代码示例来源:origin: drewnoakes/metadata-extractor

  1. @Nullable
  2. public String getWbTypeDescription(int tagType)
  3. {
  4. Integer wbtype = _directory.getInteger(tagType);
  5. if (wbtype == null)
  6. return null;
  7. return super.getLightSourceDescription(wbtype.shortValue());
  8. }
  9. }

代码示例来源:origin: drewnoakes/metadata-extractor

  1. @Nullable
  2. public String getWbTypeDescription(int tagType)
  3. {
  4. Integer wbtype = _directory.getInteger(tagType);
  5. if (wbtype == null)
  6. return null;
  7. return super.getLightSourceDescription(wbtype.shortValue());
  8. }
  9. }

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

  1. @Override
  2. protected ShortValue[] getSortedTestData() {
  3. Random rnd = new Random(874597969123412338L);
  4. short rndShort = Integer.valueOf(rnd.nextInt()).shortValue();
  5. if (rndShort < 0) {
  6. rndShort = Integer.valueOf(-rndShort).shortValue();
  7. }
  8. if (rndShort == Short.MAX_VALUE) {
  9. rndShort -= 3;
  10. }
  11. if (rndShort <= 2) {
  12. rndShort += 3;
  13. }
  14. return new ShortValue[]{
  15. new ShortValue(Short.MIN_VALUE),
  16. new ShortValue(Integer.valueOf(-rndShort).shortValue()),
  17. new ShortValue(Integer.valueOf(-1).shortValue()),
  18. new ShortValue(Integer.valueOf(0).shortValue()),
  19. new ShortValue(Integer.valueOf(1).shortValue()),
  20. new ShortValue(Integer.valueOf(2).shortValue()),
  21. new ShortValue(Integer.valueOf(rndShort).shortValue()),
  22. new ShortValue(Short.MAX_VALUE)};
  23. }
  24. }

相关文章