java.lang.Float.byteValue()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(162)

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

Float.byteValue介绍

[英]Returns the value of this Float as a byte (by casting to a byte).
[中]以字节形式返回此浮点值(通过强制转换为字节)。

代码示例

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

public Byte toByte(Float self) {
    return self.byteValue();
  }
}

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

return (X) Byte.valueOf( value.byteValue() );

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

assertFunction("sign(TINYINT '" + intValue + "')", TINYINT, signum.byteValue());

代码示例来源:origin: org.mvel/mvel2

public Object convert(Object o) {
  return ((Float) o).byteValue();
 }
});

代码示例来源:origin: com.jfinal/enjoy

public Byte toByte(Float self) {
    return self.byteValue();
  }
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

public Object convert(Object o) {
  return ((Float) o).byteValue();
 }
});

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

public Byte toByte(Float self) {
    return self.byteValue();
  }
}

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

/**
 * Coverts given floats array to array of bytes.
 *
 * @param array
 *         floats array to convert.
 *
 * @return converted array of bytes.
 */
public static byte[] toByteArray(Float[] array)
{
  byte[] result = new byte[array.length];
  for (int i = 0; i < array.length; i++)
  {
    result[i] = array[i].byteValue();
  }
  return result;
}

代码示例来源:origin: com.qwazr/qwazr-binder

@Override
public void fromFloat(Float value, Object object) {
  setByte(object, value.byteValue());
}

代码示例来源:origin: com.qwazr/qwazr-binder

@Override
public void fromFloat(Float value, Object object) {
  set(object, value.byteValue());
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

return (X) Byte.valueOf( value.byteValue() );

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

return (X) Byte.valueOf( value.byteValue() );

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

return (X) Byte.valueOf( value.byteValue() );

代码示例来源:origin: mozafari/verdictdb

public static Byte toByte(Object obj) {
  if (obj instanceof Double) return ((Double) obj).byteValue();
  else if (obj instanceof Float) return ((Float) obj).byteValue();
  else if (obj instanceof BigDecimal) return ((BigDecimal) obj).toBigInteger().byteValue();
  else if (obj instanceof Long) return ((Long) obj).byteValue();
  else if (obj instanceof Integer) return ((Integer) obj).byteValue();
  else if (obj instanceof Short) return ((Short) obj).byteValue();
  else if (obj instanceof Byte) return ((Byte) obj);
  else if (obj instanceof Boolean) return ((Boolean) obj) ? (byte) 1 : (byte) 0;
  else {
   return null;
   //      throw new VerdictDBTypeException(obj);
  }
 }
}

代码示例来源:origin: org.apache.plc4x/plc4j-protocol-driver-base

@Override
public Byte getByte(int index) {
  if (!isValidByte(index)) {
    throw new PlcIncompatibleDatatypeException(Byte.class, index);
  }
  return getValue(index).byteValue();
}

代码示例来源:origin: io.atlasmap/atlas-core

@AtlasConversionInfo(sourceType = FieldType.FLOAT, targetType = FieldType.BYTE, concerns = {
    AtlasConversionConcern.RANGE })
public Byte toByte(Float value) throws AtlasConversionException {
  if (value == null) {
    return null;
  }
  if (value % 1 == 0 && value >= Byte.MIN_VALUE && value <= Byte.MAX_VALUE) {
    return value.byteValue();
  }
  throw new AtlasConversionException(new AtlasUnsupportedException(String.format(
      "Float %s is greater than Byte.MAX_VALUE or less than Byte.MIN_VALUE or is not a whole number",
      value)));
}

代码示例来源:origin: streamsets/datacollector-api

@Override
public Byte convert(Object value) {
 if (value instanceof Byte) {
  return (Byte) value;
 }
 if (value instanceof String) {
  return Byte.parseByte((String) value);
 }
 if (value instanceof Integer) {
  return ((Integer)value).byteValue();
 }
 if (value instanceof Long) {
  return ((Long)value).byteValue();
 }
 if (value instanceof Short) {
  return ((Short)value).byteValue();
 }
 if (value instanceof Float) {
  return ((Float)value).byteValue();
 }
 if (value instanceof Double) {
  return ((Double)value).byteValue();
 }
 if (value instanceof Number) {
  return ((Number)value).byteValue();
 }
 throw new IllegalArgumentException(Utils.format(Errors.API_04.getMessage(),
                         value.getClass().getSimpleName(), value));
}

代码示例来源:origin: edu.ucar/cdm

while (iter.hasNext()) {
 ftdata[i] = iter.getFloatNext();
 bytedata[i] = new Float(ftdata[i]).byteValue();
 buffer.put(bytedata[i]);
 i++;

代码示例来源:origin: Unidata/thredds

while (iter.hasNext()) {
 ftdata[i] = iter.getFloatNext();
 bytedata[i] = new Float(ftdata[i]).byteValue();
 buffer.put(bytedata[i]);
 i++;

代码示例来源:origin: edu.ucar/netcdf

while (iter.hasNext()) {
 ftdata[i] = iter.getFloatNext();
 bytedata[i] = new Float(ftdata[i]).byteValue();
 buffer.put(bytedata[i]);
 i++;

相关文章