Article View: borland.public.jbuilder.java.language
Article #15774Re: URGENT ! converting double array into byte array
From: Chris Hill
Date: Wed, 28 Apr 1999 00:00
Date: Wed, 28 Apr 1999 00:00
34 lines
1304 bytes
1304 bytes
Use Double.doubleToLongBits(double) to move each double's bits to a long. Once you have the data in a long, it is easy to mask each byte and put it in a byte array. On Wed, 28 Apr 1999 12:47:10 -0400, RiCK <pierric.permezel@polymtl.ca> wrote: >Hello, > >I want to send a double array (double data[]) using UDP protocol. >I'm currently using datagrams object like this : > > sendPacket = new DatagramPacket( > myDatas, > myDatasLength, > clientAdress, > clientPort > ); > socket.send( sendPacket ); > >But the problem is : How do I convert my double array into a byte array, >in order to create the Datagram packet ? > >Is there another way to do the (ie: sending directly the double array) >? > >Thanks a lot for any help. > >Pierric > > Chris Hill Chris244@aol.com
Technical Details
Message-ID:
<37276b1d.3782238962@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<37273B8E.D6074926@polymtl.ca>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,27c7dd27e6c5812c X-Google-Attributes: gidf74b3,public From: Chris244@aol.com (Chris Hill) Subject: Re: URGENT ! converting double array into byte array Date: 1999/04/28 Message-ID: <37276b1d.3782238962@forums.borland.com> X-Deja-AN: 472008532 References: <37273B8E.D6074926@polymtl.ca> Organization: Another Netscape Collabra Server User Newsgroups: borland.public.jbuilder.java.language