The easiest way is to use Long.toBinaryString but I think that's not the purpose of the thread
If you have a JDK you can also check the source of the toBinaryString-method there you can find a
poser sophisticated way to solve it.
So:
To eliminate the zeros I recommend to limit the size of the array. So you must find out the count of digits of the binary number. That is the logarithm of base 2(for binary) to the input number plus 1
int[] rem = new int[(int)((Math.log(dV) / Math.log(2)) + 1)];
or in a clearer way
int arrSize = (int) ( (Math.log(dV) / Math.log(2) ) + 1);
int[] rem = new int[arrSize];
after that you print out the array backwards:
for (int j = rem.length - 1; j >= 0; j--) {
System.out.print(" " + rem[j] + " ");
}