array of char

I have a problem with array. Inputs are size of binary number and integer. I need to create char array from that integer with leading zeroes (I need those 0`s later for a logical operations). Problem is that I can not get those 0`s as a result. Can anyone help me, please

Java Code: public class adder { static int size; public static void main (String[]args){ Scanner input = new Scanner (; System.out.println("size of binary number"); size = input.nextInt(); System.out.println("enter number"); int firstNumber = input.nextInt(); String binaryNumber = Integer.toBinaryString(firstNumer); addZeroes (binaryNumber); char[] firstList = new char [size]; firstList = binaryNumber.toCharArray(); System.out.println(firstList); } public static String addZeroes(String a) { int i; i = a.length(); if (i == size) return a; else { int j = size - i; for (int k=0; k
Posted On: Thursday 25th of October 2012 01:51:58 AM Total Views:  103
View Complete with Replies