-
Conversion from byte array to float.
Hi All,
I have a byte array of size 4 whuch should be converted to its float value.
I am able to this kind of conversion (byte array) to integer primitive but
its difficult to apply the samme..
Thanx in adv,
madhu
-
Re: Conversion from byte array to float.
A better solution to this problem would be to create a float value in the
first place instead of creating a byte array and then trying to convert it.
However, here's an answer to your question:
DataInputStream dis = new DataInputStream(new
ByteArrayInputStream(yourByteArray));
float f = dis.readFloat();
But as I said, it would be better to use a DataInputStream and readFloat()
to create the value in the first place. And the same is true for integers.
PC2
"madhusudhan" <madhu_sri@indya.com> wrote in message
news:3b0cd07a$1@news.devx.com...
>
> Hi All,
> I have a byte array of size 4 whuch should be converted to its float
value.
> I am able to this kind of conversion (byte array) to integer primitive
but
>
> its difficult to apply the samme..
> Thanx in adv,
> madhu
>
>
-
Re: Conversion from byte array to float.
Hi
How does the decimal portion is stored in the byte array of size 4
"madhusudhan" <madhu_sri@indya.com> wrote:
>
>Hi All,
> I have a byte array of size 4 whuch should be converted to its float value.
> I am able to this kind of conversion (byte array) to integer primitive
but
>
>its difficult to apply the samme..
>Thanx in adv,
>madhu
>
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|