@Test public void writeFormattedLongTest() throws IOException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(16); BsUtil.writeFormattedLong(0x12345678, outputStream); BsUtil.writeFormattedLong(0x0eadbeef, outputStream); byte[] actual = outputStream.toByteArray(); byte[] expected = { (byte) 0x78, (byte) 0x56, (byte) 0x34, (byte) 0x12, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0xef, (byte) 0xbe, (byte) 0xad, (byte) 0x0e, (byte) 0, (byte) 0, (byte) 0, (byte) 0 }; Assert.assertArrayEquals(expected, actual); }
static void writeFormattedLong(final long value, OutputStream outputStream) throws IOException { long y = value; if (y < 0) { y = (-y) | NEGATIVE_MASK; } for (int i = 0; i < 8; ++i) { outputStream.write((byte) (y & 0xff)); y >>>= 8; } }
BsUtil { static void writeFormattedLong(final long value, OutputStream outputStream) throws IOException { long y = value; if (y < 0) { y = (-y) | NEGATIVE_MASK; } for (int i = 0; i < 8; ++i) { outputStream.write((byte) (y & 0xff)); y >>>= 8; } } }
BsUtil { static void writeFormattedLong(final long value, OutputStream outputStream) throws IOException { long y = value; if (y < 0) { y = (-y) | NEGATIVE_MASK; } for (int i = 0; i < 8; ++i) { outputStream.write((byte) (y & 0xff)); y >>>= 8; } }  }
BsUtil { static void writeFormattedLong(final long value, OutputStream outputStream) throws IOException { long y = value; if (y < 0) { y = (-y) | NEGATIVE_MASK; } for (int i = 0; i < 8; ++i) { outputStream.write((byte) (y & 0xff)); y >>>= 8; } }   }
BsUtil { static void writeFormattedLong(final long value, OutputStream outputStream) throws IOException { long y = value; if (y < 0) { y = (-y) | NEGATIVE_MASK; } for (int i = 0; i < 8; ++i) { outputStream.write((byte) (y & 0xff)); y >>>= 8; } }    }