Creates a {@link PairedStats} instance from the given byte representation which was obtained by {@link #toByteArray}. <p><b>Note:</b> No guarantees are made regarding stability of the representation between versions.
(byte[] byteArray)
| 302 | * versions. |
| 303 | */ |
| 304 | public static PairedStats fromByteArray(byte[] byteArray) { |
| 305 | checkNotNull(byteArray); |
| 306 | checkArgument( |
| 307 | byteArray.length == BYTES, |
| 308 | "Expected PairedStats.BYTES = %s, got %s", |
| 309 | BYTES, |
| 310 | byteArray.length); |
| 311 | ByteBuffer buffer = ByteBuffer.wrap(byteArray).order(ByteOrder.LITTLE_ENDIAN); |
| 312 | Stats xStats = Stats.readFrom(buffer); |
| 313 | Stats yStats = Stats.readFrom(buffer); |
| 314 | double sumOfProductsOfDeltas = buffer.getDouble(); |
| 315 | return new PairedStats(xStats, yStats, sumOfProductsOfDeltas); |
| 316 | } |
| 317 | |
| 318 | private static final long serialVersionUID = 0; |
| 319 | } |