public void encodeRegisterBinary(String reg,int pos, int[] encode)
    {
        String regNum = Integer.toBinaryString(Integer.parseInt(reg.split("r")[1]))+"";
        int j=3;
        while(regNum.length()<4)
        {
            regNum = 0+regNum;
        }
        
        System.out.println(regNum);
        for(int i=pos;i<pos+4;i++)
        {
            encode[i]=Integer.parseInt(regNum.charAt(j)+"");
            System.out.println(encode[i]+"i"+i);
            j--;
            
        }
        System.out.println(encode.length);
    }