🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.java.api
Article #5

Int / Short to byte[] and back

#5
From: ted
Date: Thu, 14 May 1998 00:00
19 lines
1512 bytes
Does anyone have some code to do the following functions?

public static byte[] convert(int i) {}
public static byte[] convert(short i) {}

public static int convert(byte[] i) {}
public static short convert(byte[] i) {}

Please comment on whether your code does:
    i = 65450; //FFAA

    byte[0] = 0xFF; byte[1]=0xAA;
        or
    byte[0] = 0xAA; byte[1]=0xFF;

Which is the internal representation in java and is this called big or little edian?

Thanks so much in advance.
Technical Details
Message-ID: <355B0094.D9D67382@hotmail.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f5d71,547ec6700db86f3d,start
X-Google-Attributes: gidf5d71,public
X-Google-Thread: 113ae9,547ec6700db86f3d,start
X-Google-Attributes: gid113ae9,public
X-Google-Thread: 10a146,547ec6700db86f3d,start
X-Google-Attributes: gid10a146,public
X-Google-Thread: fecd1,547ec6700db86f3d,start
X-Google-Attributes: gidfecd1,public
X-Google-Thread: 1089d0,547ec6700db86f3d,start
X-Google-Attributes: gid1089d0,public
From: ted <tedted40@hotmail.com>
Subject: Int / Short to byte[] and back
Date: 1998/05/14
Message-ID: <355B0094.D9D67382@hotmail.com>
X-Deja-AN: 353205947
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: newsabuse@supernews.com
X-Trace: 895156614 ML2QBYQ5MA672CDF2C usenet50.supernews.com
Organization: All USENET -- http://www.Supernews.com
Newsgroups: comp.lang.java.api,comp.lang.java,comp.lang.java.programmer,comp.lang.java.help,borland.public.jbuilder.java.api