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

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

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

Double.byteValue介绍

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

代码示例

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

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

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

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

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

/**
 * @param value string represented numerical value
 * @return value as Byte
 */
public static Byte getByteValue(String value) {
  nBytes++;
  return parseDoubleUnit(value).byteValue();
}

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

private void updateSignedTable(Connection conn, double data) throws Exception {
  PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + signedTableName + " VALUES (?, ?, ?, ?, ?, ?, ?)");
  stmt.setString(1, KEY);
  Double d = Double.valueOf(data);
  stmt.setDouble(2, d.doubleValue());
  stmt.setFloat(3, d.floatValue());
  stmt.setInt(4, d.intValue());
  stmt.setLong(5, d.longValue());
  stmt.setShort(6, d.shortValue());
  stmt.setByte(7, d.byteValue());
  stmt.executeUpdate();
  conn.commit();
}

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

private void updateUnsignedTable(Connection conn, double data) throws Exception {
  PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + testUnsignedTable + " VALUES (?, ?, ?, ?, ?, ?, ?)");
  stmt.setString(1, KEY);
  Double d = Double.valueOf(data);
  stmt.setDouble(2, d.doubleValue());
  stmt.setFloat(3, d.floatValue());
  stmt.setInt(4, d.intValue());
  stmt.setLong(5, d.longValue());
  stmt.setShort(6, d.shortValue());
  stmt.setByte(7, d.byteValue());
  stmt.executeUpdate();
  conn.commit();
}

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

private void updateUnsignedTable(Connection conn, double data) throws Exception {
  PreparedStatement stmt = conn.prepareStatement(
    "UPSERT INTO " + unsignedTableName + " VALUES (?, ?, ?, ?, ?, ?, ?)");
  stmt.setString(1, KEY);
  Double d = Double.valueOf(data);
  stmt.setDouble(2, d.doubleValue());
  stmt.setFloat(3, d.floatValue());
  stmt.setInt(4, d.intValue());
  stmt.setLong(5, d.longValue());
  stmt.setShort(6, d.shortValue());
  stmt.setByte(7, d.byteValue());
  stmt.executeUpdate();
  conn.commit();
}

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

private void updateSignedTable(Connection conn, double data) throws Exception {
  PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + TABLE_NAME + " VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
  stmt.setString(1, KEY);
  Double d = Double.valueOf(data);
  stmt.setBigDecimal(2, BigDecimal.valueOf(data));
  stmt.setDouble(3, d.doubleValue());
  stmt.setFloat(4, d.floatValue());
  stmt.setInt(5, d.intValue());
  stmt.setLong(6, d.longValue());
  stmt.setShort(7, d.shortValue());
  stmt.setByte(8, d.byteValue());
  stmt.executeUpdate();
  conn.commit();
}

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

private void updateTableSpec(Connection conn, double data, String tableName) throws Exception {
  PreparedStatement stmt =
      conn.prepareStatement("UPSERT INTO " + tableName + " VALUES (?, ?, ?, ?, ?, ?, ?)");
  stmt.setString(1, KEY);
  Double d = Double.valueOf(data);
  stmt.setDouble(2, d.doubleValue());
  stmt.setFloat(3, d.floatValue());
  stmt.setInt(4, d.intValue());
  stmt.setLong(5, d.longValue());
  stmt.setShort(6, d.shortValue());
  stmt.setByte(7, d.byteValue());
  stmt.executeUpdate();
  conn.commit();
}

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

private void updateSignedTable(Connection conn, double data) throws Exception {
  PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + testSignedTable + " VALUES (?, ?, ?, ?, ?, ?, ?)");
  stmt.setString(1, KEY);
  Double d = Double.valueOf(data);
  stmt.setDouble(2, d.doubleValue());
  stmt.setFloat(3, d.floatValue());
  stmt.setInt(4, d.intValue());
  stmt.setLong(5, d.longValue());
  stmt.setShort(6, d.shortValue());
  stmt.setByte(7, d.byteValue());
  stmt.executeUpdate();
  conn.commit();
}

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

private void updateUnsignedTable(Connection conn, double data) throws Exception {
  PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + unsignedTableName + " VALUES (?, ?, ?, ?, ?, ?, ?)");
  stmt.setString(1, KEY);
  Double d = Double.valueOf(data);
  stmt.setDouble(2, d.doubleValue());
  stmt.setFloat(3, d.floatValue());
  stmt.setInt(4, d.intValue());
  stmt.setLong(5, d.longValue());
  stmt.setShort(6, d.shortValue());
  stmt.setByte(7, d.byteValue());
  stmt.executeUpdate();
  conn.commit();
}

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

private void updateSignedTable(Connection conn, double data) throws Exception {
  PreparedStatement stmt = conn.prepareStatement(
    "UPSERT INTO " + signedTableName + " VALUES (?, ?, ?, ?, ?, ?, ?)");
  stmt.setString(1, KEY);
  Double d = Double.valueOf(data);
  stmt.setDouble(2, d.doubleValue());
  stmt.setFloat(3, d.floatValue());
  stmt.setInt(4, d.intValue());
  stmt.setLong(5, d.longValue());
  stmt.setShort(6, d.shortValue());
  stmt.setByte(7, d.byteValue());
  stmt.executeUpdate();
  conn.commit();
}

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

private void updateUnsignedTable(Connection conn, double data) throws Exception {
  PreparedStatement stmt = conn.prepareStatement(
    "UPSERT INTO " + unsignedTableName + " VALUES (?, ?, ?, ?, ?, ?, ?)");
  stmt.setString(1, KEY);
  Double d = Double.valueOf(data);
  stmt.setDouble(2, d.doubleValue());
  stmt.setFloat(3, d.floatValue());
  stmt.setInt(4, d.intValue());
  stmt.setLong(5, d.longValue());
  stmt.setShort(6, d.shortValue());
  stmt.setByte(7, d.byteValue());
  stmt.executeUpdate();
  conn.commit();
}

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

private void updateSignedTable(Connection conn, double data) throws Exception {
  PreparedStatement stmt = conn.prepareStatement(
    "UPSERT INTO " + signedTableName + " VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
  stmt.setString(1, KEY);
  Double d = Double.valueOf(data);
  stmt.setBigDecimal(2, BigDecimal.valueOf(data));
  stmt.setDouble(3, d.doubleValue());
  stmt.setFloat(4, d.floatValue());
  stmt.setInt(5, d.intValue());
  stmt.setLong(6, d.longValue());
  stmt.setShort(7, d.shortValue());
  stmt.setByte(8, d.byteValue());
  stmt.executeUpdate();
  conn.commit();
}

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

private void updateTableSpec(Connection conn, double data, String tableName) throws Exception {
  PreparedStatement stmt =
      conn.prepareStatement("UPSERT INTO " + tableName + " VALUES (?, ?, ?, ?, ?, ?, ?)");
  stmt.setString(1, KEY);
  Double d = Double.valueOf(data);
  stmt.setDouble(2, d.doubleValue());
  stmt.setFloat(3, d.floatValue());
  stmt.setInt(4, d.intValue());
  stmt.setLong(5, d.longValue());
  stmt.setShort(6, d.shortValue());
  stmt.setByte(7, d.byteValue());
  stmt.executeUpdate();
  conn.commit();
}

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

private void testSignedNumberSpec(Connection conn, double data) throws Exception {
  updateSignedTable(conn, data);
  ResultSet rs = conn.createStatement().executeQuery("SELECT EXP(doub),EXP(fl),EXP(inte),EXP(lon),EXP(smalli),EXP(tinyi) FROM " + signedTableName);
  assertTrue(rs.next());
  Double d = Double.valueOf(data);
  assertTrue(Math.abs(rs.getDouble(1) - Math.exp(d.doubleValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(2) - Math.exp(d.floatValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(3) - Math.exp(d.intValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(4) - Math.exp(d.longValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(5) - Math.exp(d.shortValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(6) - Math.exp(d.byteValue())) < ZERO);
  assertTrue(!rs.next());
}

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

private void testUnsignedNumberSpec(Connection conn, double data) throws Exception {
  updateUnsignedTable(conn, data);
  ResultSet rs = conn.createStatement().executeQuery("SELECT EXP(doub),EXP(fl),EXP(inte),EXP(lon),EXP(smalli),EXP(tinyi) FROM " + unsignedTableName);
  assertTrue(rs.next());
  Double d = Double.valueOf(data);
  assertTrue(Math.abs(rs.getDouble(1) - Math.exp(d.doubleValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(2) - Math.exp(d.floatValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(3) - Math.exp(d.intValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(4) - Math.exp(d.longValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(5) - Math.exp(d.shortValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(6) - Math.exp(d.byteValue())) < ZERO);
  assertTrue(!rs.next());
}

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

private void testUnsignedNumberSpec(Connection conn, double data) throws Exception {
  updateUnsignedTable(conn, data);
  ResultSet rs = conn.createStatement().executeQuery("SELECT SQRT(doub),SQRT(fl),SQRT(inte),SQRT(lon),SQRT(smalli),SQRT(tinyi) FROM " + testUnsignedTable );
  assertTrue(rs.next());
  Double d = Double.valueOf(data);
  assertTrue(Math.abs(rs.getDouble(1) - Math.sqrt(d.doubleValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(2) - Math.sqrt(d.floatValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(3) - Math.sqrt(d.intValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(4) - Math.sqrt(d.longValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(5) - Math.sqrt(d.shortValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(6) - Math.sqrt(d.byteValue())) < ZERO);
  assertTrue(!rs.next());
  PreparedStatement stmt = conn.prepareStatement("SELECT k FROM " + testUnsignedTable + " WHERE SQRT(doub)>0 AND SQRT(fl)>0 AND SQRT(inte)>0 AND SQRT(lon)>0 AND SQRT(smalli)>0 AND SQRT(tinyi)>0");
  rs = stmt.executeQuery();
  if (data > 0) {
    assertTrue(rs.next());
    assertEquals(KEY, rs.getString(1));
  }
  assertTrue(!rs.next());
}

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

private void testSignedNumberSpec(Connection conn, double data) throws Exception {
  updateSignedTable(conn, data);
  ResultSet rs = conn.createStatement().executeQuery("SELECT SQRT(doub),SQRT(fl),SQRT(inte),SQRT(lon),SQRT(smalli),SQRT(tinyi) FROM " + testSignedTable );
  assertTrue(rs.next());
  Double d = Double.valueOf(data);
  assertTrue(Math.abs(rs.getDouble(1) - Math.sqrt(d.doubleValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(2) - Math.sqrt(d.floatValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(3) - Math.sqrt(d.intValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(4) - Math.sqrt(d.longValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(5) - Math.sqrt(d.shortValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(6) - Math.sqrt(d.byteValue())) < ZERO);
  assertTrue(!rs.next());
  PreparedStatement stmt = conn.prepareStatement("SELECT k FROM " + testSignedTable + " WHERE SQRT(doub)>0 AND SQRT(fl)>0 AND SQRT(inte)>0 AND SQRT(lon)>0 AND SQRT(smalli)>0 AND SQRT(tinyi)>0");
  rs = stmt.executeQuery();
  if (data > 0) {
    assertTrue(rs.next());
    assertEquals(KEY, rs.getString(1));
  }
  assertTrue(!rs.next());
}

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

private void testSignedNumberSpec(Connection conn, double data) throws Exception {
  updateSignedTable(conn, data);
  ResultSet rs = conn.createStatement().executeQuery(
    "SELECT CBRT(doub),CBRT(fl),CBRT(inte),CBRT(lon),CBRT(smalli),CBRT(tinyi) FROM "
      + signedTableName);
  assertTrue(rs.next());
  Double d = Double.valueOf(data);
  assertTrue(Math.abs(rs.getDouble(1) - Math.cbrt(d.doubleValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(2) - Math.cbrt(d.floatValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(3) - Math.cbrt(d.intValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(4) - Math.cbrt(d.longValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(5) - Math.cbrt(d.shortValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(6) - Math.cbrt(d.byteValue())) < ZERO);
  assertTrue(!rs.next());
  PreparedStatement stmt = conn.prepareStatement("SELECT k FROM " + signedTableName
    + " WHERE CBRT(doub)>0 AND CBRT(fl)>0 AND CBRT(inte)>0 AND CBRT(lon)>0 AND CBRT(smalli)>0 AND CBRT(tinyi)>0");
  rs = stmt.executeQuery();
  if (data > 0) {
    assertTrue(rs.next());
    assertEquals(KEY, rs.getString(1));
  }
  assertTrue(!rs.next());
}

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

private void testUnsignedNumberSpec(Connection conn, double data) throws Exception {
  updateUnsignedTable(conn, data);
  ResultSet rs = conn.createStatement().executeQuery(
    "SELECT CBRT(doub),CBRT(fl),CBRT(inte),CBRT(lon),CBRT(smalli),CBRT(tinyi) FROM "
      + unsignedTableName);
  assertTrue(rs.next());
  Double d = Double.valueOf(data);
  assertTrue(Math.abs(rs.getDouble(1) - Math.cbrt(d.doubleValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(2) - Math.cbrt(d.floatValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(3) - Math.cbrt(d.intValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(4) - Math.cbrt(d.longValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(5) - Math.cbrt(d.shortValue())) < ZERO);
  assertTrue(Math.abs(rs.getDouble(6) - Math.cbrt(d.byteValue())) < ZERO);
  assertTrue(!rs.next());
  PreparedStatement stmt = conn.prepareStatement("SELECT k FROM " + unsignedTableName
    + " WHERE CBRT(doub)>0 AND CBRT(fl)>0 AND CBRT(inte)>0 AND CBRT(lon)>0 AND CBRT(smalli)>0 AND CBRT(tinyi)>0");
  rs = stmt.executeQuery();
  if (data > 0) {
    assertTrue(rs.next());
    assertEquals(KEY, rs.getString(1));
  }
  assertTrue(!rs.next());
}

相关文章