int highNibble = (b1 >> 4) & 0xF;
int highNibble = ((b1 & 0xFF) >> 4) & 0xF;
    protected CoderResult decodeLoop (ByteBuffer in, CharBuffer out)    {      // TODO: Optimize this in the case in.hasArray() / out.hasArray()      int inPos = in.position();       try        {          while (in.hasRemaining ())            {              char c;              byte b1 = in.get ();              int highNibble = (b1 >> 4) & 0xF;              switch (highNibble)                {                  case 0: case 1: case 2: case 3:                  case 4: case 5: case 6: case 7:                    if (out.remaining () < 1)                      return CoderResult.OVERFLOW;                    out.put ((char) b1);                    inPos++;                    break;                  case 0xC: case 0xD:                    byte b2;                    if (in.remaining () < 1)                      return CoderResult.UNDERFLOW;                    if (out.remaining () < 1)                      return CoderResult.OVERFLOW;                    if (!isContinuation (b2 = in.get ()))                      return CoderResult.malformedForLength (1);                    c = (char) (((b1 & 0x1F) << 6) | (b2 & 0x3F));                    // check that we had the shortest encoding                    if (c <= 0x7F)                      return CoderResult.malformedForLength (2);                    out.put (c);                    inPos += 2;                    break;                  case 0xE:                    byte b3;                    if (in.remaining () < 2)                      return CoderResult.UNDERFLOW;                    if (out.remaining () < 1)                      return CoderResult.OVERFLOW;                    if (!isContinuation (b2 = in.get ()))                      return CoderResult.malformedForLength (1);                    if (!isContinuation (b3 = in.get ()))                      return CoderResult.malformedForLength (1);                    c = (char) (((b1 & 0x0F) << 12)                                | ((b2 & 0x3F) << 6)                                | (b3 & 0x3F));                    // check that we had the shortest encoding                    if (c <= 0x7FF)                      return CoderResult.malformedForLength (3);                    out.put (c);                    inPos += 3;                    break;                  default:                    return CoderResult.malformedForLength (1);                }            }          return CoderResult.UNDERFLOW;        }      finally        {          // In case we did a get(), then encountered an error, reset the          // position to before the error.  If there was no error, this          // will benignly reset the position to the value it already has.          in.position (inPos);        }    }