private static int makeByte(int lowNibble, int highNibble) {
    if ((lowNibble & ~0xf) != 0) {
      throw new IllegalArgumentException("bogus lowNibble");
    }

    if ((highNibble & ~0xf) != 0) {
      throw new IllegalArgumentException("bogus highNibble");
    }

    return lowNibble | (highNibble << 4);
  }
Helper method that encodes any of the three-unit register-range formats.
android/android_framework/dex-maker/src/main/java/com/android/dx/io/instructions/InstructionCodec.java