79555813

Date: 2025-04-04 16:07:02
Score: 1.5
Natty:
Report link

You can copy values to integer and switch negative values into its positive 'unsigned' value:

byte[] bytes = [-1, 10, -128];
    
int[] ints = new int[bytes.length];
for (int idx = 0 ; idx < bytes.length ; idx++) {
    byte b = bytes[idx];
    ints[idx] = b < 0 ? 256 + b : b;
}
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: Javier