Java Bit String From toBitString(int meta)

Here you can find the source of toBitString(int meta)

Description

to Bit String

License

Open Source License

Declaration

public static String toBitString(int meta) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String toBitString(int meta) {
        StringBuilder sb = new StringBuilder();
        for (int k = 0; k < 4; k++) {
            if (((meta >> k) & 1) == 1) {
                sb.append(1);//  ww  w  .j av a2 s . c  om
            } else {
                sb.append(0);
            }
        }
        return sb.toString();
    }
}

Related

  1. toBitString(final byte[] b)
  2. toBitString(final byte[] b)
  3. toBitString(final double d)
  4. toBitString(final StringBuilder sb, final byte value, final int count2)
  5. toBitString(int i)
  6. toBitString(long i)