DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    madhusudhan Guest

    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



  2. #2
    Paul Clapham Guest

    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
    >
    >




  3. #3
    Rajkamal Gopinath Guest

    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
    >
    >



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links