Java Bit Print printBitFormat(int number)

Here you can find the source of printBitFormat(int number)

Description

print Bit Format

License

Apache License

Declaration

public static void printBitFormat(int number) 

Method Source Code

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

public class Main {
    private static final int INT_SIZE = 32;

    public static void printBitFormat(int number) {
        for (int idx = INT_SIZE - 1; idx >= 0; --idx) {
            if ((number & (1 << idx)) == 0) {
                System.out.print("0");
            } else {
                System.out.print("1");
            }/*from  w w  w .  j a  v a  2  s .  c o  m*/
        }

        System.out.println();
    }
}

Related

  1. printBitBinary(byte[] bytes)
  2. printBitboard(long bitboard)
  3. printBitLong(long A)
  4. printBits(byte[] bytes)
  5. printBits(int meta)
  6. printBits(int number, int n)