Android Int to Binary Convert digitToBinary(int digit)

Here you can find the source of digitToBinary(int digit)

Description

digit To Binary

Declaration

private static String digitToBinary(int digit) 

Method Source Code

//package com.java2s;

public class Main {
    private static String digitToBinary(int digit) {
        return String.format("%4s", Integer.toBinaryString(digit)).replace(
                " ", "0");
    }/*  w  w w  .  j  a v a2s .co m*/

    private static String digitToBinary(String digit) {
        return String.format("%4s",
                Integer.toBinaryString(Integer.valueOf(digit, 10)))
                .replace(" ", "0");
    }
}

Related

  1. digitToBinary(String digit)