import java.lang.Math.*;

public class BCDBinaer {
  public static void main(String[] args) {
    boolean[] blah = decToBin(24783647);
    for(byte i=0; i<blah.length; i++) {
      if (blah[i]) {
        System.out.print(1);
      }
      else {
        System.out.print(0);
      }
    }
  }

  public static boolean[] decToBin(int n) {
    byte bits = proposeBitCount(n);
    boolean[] binarray = new boolean[bits];
    
    for(int i=bits-1; i>=0; i--) {
      if (Math.pow(2, i) <= n) {
        n -= Math.pow(2, i);
        binarray[bits-1-i] = true;
      }
      else {
        binarray[bits-1-i] = false;
      }
    }

    return binarray;
  }
  
  static byte proposeBitCount(int n) {
    // propose a number of bits used to display decimal `n`
    // as binary.
    if (n < 0) {
      // illegal
      return 0;
    }
    if (n <= 14) {
      return 4;
      // half byte
    }
    
    for(byte i=8; i<=Byte.MAX_VALUE+1; i*=2) {
      if (n <= Math.pow(2, i)-1) {
        return i;
      }
      // try wether 2^8 (16, 32, ..., 32.767) fits into `n`
    }
    
    return 0;
    // mustn't happen...
  }
}
