Can any one tell me how to Convert long value to byte array of size 4
You need 8 bytes to represent a long value unless that long value can be cast to an int without losing information. One simple way to do such conversions is using java.nio.ByteBuffer
Long k = new Long(long value);
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Participation.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.