private String convert(int num){
        if (num == 0){
            return "";
        }
        int bit_of_num = 0;
        int tmp = Math.abs(num);
        while( tmp != 0){
            tmp >>= 1;
            ++bit_of_num;
        }

        StringBuffer res;
        if (num > 0) {
            res = new StringBuffer(Integer.toBinaryString(num));
        }else{
            num = Math.abs(num);
            res = new StringBuffer(Integer.toBinaryString((1<<bit_of_num)-1 - num));
        }
        while ( res.length() < bit_of_num) {
            res.insert(0, '0');
        }
        return res.toString();
    }