jeg modtager noget data i et byte array, som angiver et ID - men id'et er i hexadecimal, så jeg ønsker at få konverteret mit bytearray til noget hvor jeg kan se "tallene" fra 0-F i stedet.
while (i < in.length) { ch = (byte) (in[i] & 0xF0); // Strip off high nibble ch = (byte) (ch >>> 4); // shift the bits down ch = (byte) (ch & 0x0F); // must do this is high order bit is on! out.append(pseudo[ (int) ch]); // convert the nibble to a String Character ch = (byte) (in[i] & 0x0F); // Strip off low nibble out.append(pseudo[ (int) ch]); // convert the nibble to a String Character i++; }
String rslt = new String(out);
return rslt; }
vupti!!
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.