public void encode_ascii(String encoded_string) throws IOException
    {
        File op = new File("output.txt");
        n=0;
        BufferedWriter bw = new BufferedWriter(new FileWriter(op));
        String temp=String.valueOf(encoded_string.charAt(0));
        for(int i=1;i<encoded_string.length();i++)
            if(i%8==0){
                //System.out.println(temp);
                bw.write((char)(Integer.parseInt(temp, 2)));
                temp=String.valueOf(encoded_string.charAt(i));
            }
            else
                temp+=String.valueOf(encoded_string.charAt(i));
            //System.out.println(temp);
            if(temp.length()==8)
                bw.write((char)(Integer.parseInt(temp, 2)));
            else{
                /*bw.write('X');
                bw.write(temp);
            */
            n=8-temp.length();
            while(temp.length()!=8)
                temp="0"+temp;
             bw.write((char)(Integer.parseInt(temp, 2)));
            }
        bw.close();
    }