| Author |
Convert Object to byte array and array size should be 40
|
Srikanth Nakka
Greenhorn
Joined: Apr 15, 2007
Posts: 26
|
|
i want to convert above class to byte array and array size should be 40
please help me on how to convert class to byte array and size should be 40
|
Thanking You,
Srikanth Nakka
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
You can't without losing data. A long needs 8 data, a char and a short 2. Therefore, you need 8 + 8 + 2*2 + 2 + 2 + 8*2 + 8*2 + 8*2 + 2 = 74 bytes. Even if you use only one byte per char (which is possible for ASCII characters) you still need 48 bytes.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Rusty Shackleford
Ranch Hand
Joined: Jan 03, 2006
Posts: 490
|
|
You might be able to shrink those class members down via huffman encoding, that way you will lose nothing.
Your subject implies to me that you are looking to split up the serialized object into a byte array? If that is the case, I have to ask why? If I am misreading, can you clarify what you are looking to do and why please?
|
 |
 |
|
|
subject: Convert Object to byte array and array size should be 40
|
|
|