Android Int to Binary Convert digitToBinary(String digit)

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

Description

digit To Binary

Declaration

private static String digitToBinary(String 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");
    }/* ww w .  j  a  v  a2  s. com*/

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

Related

  1. digitToBinary(int digit)