Java Byte to Binary byteToBinary(byte value)

Here you can find the source of byteToBinary(byte value)

Description

Return a binary string representation of the byte.

License

Apache License

Parameter

Parameter Description
value byte to convert

Return

A binary string representation of the byte.

Declaration

public static String byteToBinary(byte value) 

Method Source Code

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

public class Main {
    /**//w  w  w. j a  va  2 s . c  o m
     * Return a binary string representation of the byte.
     * @param value byte to convert
     * @return A binary string representation of the byte.
     */
    public static String byteToBinary(byte value) {
        return String.format("%8s", Integer.toBinaryString(value & 0xFF)).replace(' ', '0');
    }
}

Related

  1. byteToBin(byte[] bs)
  2. byteToBinaryStr(byte b)
  3. byteToBinaryString(byte i)
  4. byteToBinaryString(byte toString)