Java Bit Shift shiftBits(byte b)

Here you can find the source of shiftBits(byte b)

Description

shift Bits

License

Apache License

Declaration

public static byte shiftBits(byte b) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static final int b1 = Integer.parseInt("11110000", 2);
    public static final int b2 = Integer.parseInt("1111", 2);

    public static byte shiftBits(byte b) {
        int upper = b << 4 & b1;
        int lower = b >> 4 & b2;
        //      if (LangUtil.getBit(7, b)) {
        //         lower = lower | b3;
        //      }
        return (byte) (upper | lower);
    }// w  w  w  .j  a  v a  2 s. c om
}

Related

  1. shift(int a, int b)
  2. shift(int component, int shift)
  3. shift(int direction, long sq, int delta)
  4. shift(int length)
  5. shift(String string)
  6. shiftByte(byte n, short shift)
  7. shiftCharacter(char c, int offset)
  8. shiftDouble(Object o, double shift, String suffix)
  9. shiftHorizontally(int inkX, int inkXWidth, int textWidth)