Java - writeLong method of DataOutputStream and writing hex
-
21-09-2019 - |
Question
Currently, I have:
outByte.writeInt(0x49492a00);
outByte.writeInt(0x08000000);
But i want to be able to write all of that on the same line. But:
outByte.writeLong(0x49492a0008000000)
is underlined red in Eclipse, and therefore incorrect. Is it possible to write those two lines all in one with writeLong()?
Solution
To use a long
literal in your source code, you will need to append l
or L
to the constant like this:
outByte.writeLong(0x49492a0008000000L)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow