Java Bit Get bitAt(byte b, int pos)

Here you can find the source of bitAt(byte b, int pos)

Description

bit At

License

Apache License

Declaration

static int bitAt(byte b, int pos) 

Method Source Code

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

public class Main {
    static int bitAt(byte b, int pos) {
        int i = 1 << 7 - pos;
        return (b & i & 0xFF) > 0 ? 1 : 0;
    }/*from  w  ww.j  av a 2s  .  c  o  m*/
}

Related

  1. bitAt(int offset, byte aByte)
  2. bitAt(int offset, byte aByte)
  3. bits(int i)
  4. bits(int i)