Here you can find the source of toBinary(long v, int len)
public static char[] toBinary(long v, int len)
//package com.java2s; //License from project: Open Source License public class Main { public static char[] toBinary(long v, int len) { char[] cs = new char[len]; for (int i = 0; i < len; i++) { cs[i] = (v >> (len - i - 1) & 1) != 0 ? '1' : '0'; }/*w w w.j a v a 2 s. c o m*/ return cs; } }