package no.nordicsemi.utils;

import java.math.BigInteger;

public class NumberUtils {

    public static byte[] stringNumberToByteArray(String number, int radix, int size) {
        byte[] array = new BigInteger(number, radix).toByteArray();
        byte[] sizedArray = new byte[size];
        System.arraycopy(array, 0, sizedArray, 0, Math.min(size, array.length));
        return sizedArray;
    }
}

@@ -280,16 +280,101 @@
 %5Bsize%5D;%0A
+        int signOffset = array%5B0%5D == 0 ? 1 : 0; //http://stackoverflow.com/q/4407779%0A
         
@@ -397,17 +397,26 @@
 (array, 
-0
+signOffset
 , sizedA
@@ -455,16 +455,17 @@
 ngth));%0A
+%0A
         

Fix sign bug in NumberUtils