static short shortFromBytes(byte[] a, int i) {
  ret (short) (ubyteToInt(a[i]) << 8
    | ubyteToInt(a[i+1]));
}