Java Binary Encode toBinaryString(int number, int length)

Here you can find the source of toBinaryString(int number, int length)

Description

to Binary String

License

Open Source License

Declaration

public static String toBinaryString(int number, int length) 

Method Source Code

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

public class Main {
    public static String toBinaryString(int number, int length) {
        String result = new String(Integer.toBinaryString(number));
        while (result.length() < length) {
            result = '0' + result;
        }//from ww  w  .  java 2  s . co  m
        return result;
    }
}

Related

  1. toBinaryString(final char[] arr)
  2. toBinaryString(int a, int bits)
  3. toBinaryString(int b, int bits)
  4. toBinaryString(int l, int L)
  5. toBinaryString(int number)
  6. toBinaryString(int value)
  7. toBinaryString(int[] input)
  8. toBinaryString(long val)
  9. toBinaryString(long value, int bitLegnth)