File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes small question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "small question" Watch "small question" New topic
Author

small question

Mohammad Ahmad
Greenhorn

Joined: Mar 21, 2006
Posts: 18
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

Joined: Sep 16, 2005
Posts: 1780
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 ]

There is no emoticon for what I am feeling!
Mohammad Ahmad
Greenhorn

Joined: Mar 21, 2006
Posts: 18
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

Joined: Sep 16, 2005
Posts: 1780
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: small question