Java Utililty Methods Bit Print

List of utility methods to do Bit Print

  1. HOME
  2. Java
  3. B
  4. Bit Print

Description

The list of methods to do Bit Print are organized into topic(s).

Method

String printBitBinary(byte[] bytes)
Transform bite array to bit representation
StringBuilder sb = new StringBuilder();
for (byte b : bytes) {
 String s = Integer.toBinaryString((b & 0xFF) + 0x100).substring(1);
 if (sb.length() > 0) {
 sb.append(" ");
 if (s.length() > 4) {
 sb.append(s.substring(0, 4)).append(" ").append(s.substring(4, s.length()));
...
void printBitboard(long bitboard)
Prints a bitboard by sending the result of bitboardToString to System.out.
System.out.println(bitboardToString(bitboard));
void printBitFormat(int number)
print Bit Format
for (int idx = INT_SIZE - 1; idx >= 0; --idx) {
 if ((number & (1 << idx)) == 0) {
 System.out.print("0");
 } else {
 System.out.print("1");
System.out.println();
...
void printBitLong(long A)
print Bit Long
System.out.println(toPadString(A));
void printBits(byte[] bytes)
print Bits
boolean firstFlag = true;
StringBuffer logBuffer = new StringBuffer();
String b = "";
for (byte i : bytes) {
 b = Integer.toHexString(i & 0xff);
 b = (b.length() == 1 ? ("0" + b) : b);
 if (firstFlag) {
 logBuffer.append("[" + b);
...
void printBits(int meta)
print Bits
for (int k = 0; k < 4; k++) {
 if (((meta >> k) & 1) == 1) {
 System.out.print(1);
 } else {
 System.out.print(0);
System.out.println();
...
String printBits(int number, int n)
print Bits
String s = "";
for (int i = 0; i < n; i++) {
 s += getBit(number, i) ? "1" : "0";
return s;
void printBits(long val, int bits)
print Bits
while (bits-- != 0) {
 System.out.print(((val >>> bits) & 1) != 0 ? '1' : '0');
String printBits(long value)
Print the bits in the value with the leftmost bit being the most significant bit.
StringBuffer sb = new StringBuffer();
for (int shift = 63; shift >= 0; shift--)
 sb.append((((value >>> shift) & 01) != 0) ? "1" : "0");
return sb.toString();


AltStyle によって変換されたページ (->オリジナル) /