Beispiel #1
0
 /**
  * @param t operands
  * @return Array of byte arrays made from passed array of Text
  */
 public static byte[][] toByteArrays(final String[] t) {
   byte[][] result = new byte[t.length][];
   for (int i = 0; i < t.length; i++) {
     result[i] = Bytes.toBytes(t[i]);
   }
   return result;
 }
Beispiel #2
0
 /**
  * Serialize a double as the IEEE 754 double format output. The resultant array will be 8 bytes
  * long.
  *
  * @param d value
  * @return the double represented as byte []
  */
 public static byte[] toBytes(final double d) {
   // Encode it as a long
   return Bytes.toBytes(Double.doubleToRawLongBits(d));
 }
Beispiel #3
0
 /**
  * @param f float value
  * @return the float represented as byte []
  */
 public static byte[] toBytes(final float f) {
   // Encode it as int
   return Bytes.toBytes(Float.floatToRawIntBits(f));
 }