🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.java.api
1 messages
1 total messages Started by ted Thu, 14 May 1998 00:00
Int / Short to byte[] and back
#5
Author: 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.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads