Java Bits Convert to bitboardToString(final long l)

Here you can find the source of bitboardToString(final long l)

Description

Takes a bitboard and returns a 64 character string representation

License

Open Source License

Declaration

public static String bitboardToString(final long l) 

Method Source Code

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

public class Main {
    /** Takes a bitboard and returns a 64 character string representation */
    public static String bitboardToString(final long l) {
        final String lString = Long.toBinaryString(l);
        final byte paddingZeros = (byte) (64 - lString.length());
        final StringBuilder b = new StringBuilder(64);
        for (byte i = 0; i < paddingZeros; i++) {
            b.append("0");
        }/*  w  w w. j av a 2 s  . c o m*/
        for (byte i = 0; i < lString.length(); i++) {
            b.append(lString.charAt(i));
        }
        return b.toString();
    }
}

Related

  1. BIT(int x)
  2. bitArray2byte(boolean[] array)
  3. bitarrayShiftAndFill(byte[] data, int length, int shift, byte first, byte last)
  4. bitArrayToByte(byte[] bytes)
  5. BitArrayToString(Boolean[] asciiBinary)
  6. bitboardToString(long bitboard)
  7. bitch(Throwable t)
  8. bitFieldToIndexArray(long bitfield)
  9. bitFieldToString(boolean[] bits)