• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

small question

 
Mohammad Ahmad
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if i have defined in my code (java):
static int length;
then i need to convert and represent this integer into 64-bit big indean what shall i do in java ...can i find any function to do this??
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Datatype long is 64 bit. Since you mention "big-endian", are you thinking of writing it to an OutputStream? Any class that implements java.io.DataOutput has the method writeLong(long) (which requires the bytes to be written in order high to low), for example the classes DataOutputStream, ObjectOutputStream and RandomAccessFile.
[ March 22, 2006: Message edited by: Jeff Albertson ]
 
Mohammad Ahmad
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i really dont understand what u want to ask...but what iam going to do is to represent the integer i have into 64-bit big indean integer in order to make appending operation with other string of bitds so this what i need ...
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mohammad Ahmad:
i really dont understand what u want to ask...but what iam going to do is to represent the integer i have into 64-bit big indean integer in order to make appending operation with other string of bitds so this what i need ...


Permit me to be confused as well. It seems that you don't need to "represent" an integer in 64-bit big-endian format so much as "append" such a representation to some data structure. Aren't binary streams an example of this and DataOutput a solution? You use the term "string", but do you really mean java.lang.String? Strings are sequences of characters, so unless you have some specific encoding in mind, I wouldn't mix them with binary data.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic