code: private static byte [] binaryIncrementPos(byte [] value, long amount) {
      long amo = amount;
      int sign = 1;
      if (amount < 0) {
        amo = -amount;
        sign = -1;
      }
      for (int i = 0; i < value.length; i++) {
        int cur = ((int) amo % 256) * sign;
        amo = (amo >> 8);
        int val = value[value.length - i - 1] & 0x0ff;
        int total = val + cur;
        if (total > 255) {
          amo += sign;
          total %= 256;
        } else if (total < 0) {
          amo -= sign;
        }
        value[value.length - i - 1] = (byte) total;
        if (amo == 0) {
          return value;
        }
      }
      return value;
    }
docs: /* increment/deincrement for positive value