import java.io.*;

public class drop3 {
	
   /*==========================================================================*/
    
    public byte[] buf;								/*1*/
    
    public int size;								/*2*/
    
    public drop3(int maxsize) {							/*3*/
	int byte_size;								/*4*/
	byte_size = (maxsize >> 3) +1;						/*5*/
	buf = new byte[byte_size];						/*6*/
	size = 0;								/*7*/
    }

    public drop3(String filename) throws IOException {				/*8*/
	FileInputStream fis = new FileInputStream(filename);			/*9*/
	int bytesize;								/*10*/
	buf = new byte[4000000];						/*11*/
	bytesize = fis.read(buf, 0, 4000000);					/*12*/
	size = bytesize * 8;							/*13*/
    }
    

    public drop3(byte[] buf1, int size1) {					/*14*/
	buf = buf1;								/*15*/
	size = size1;								/*16*/
    }

 

    public int get_packet(int i) {						/*17*/
	int byte_offset, bit_offset,present,present2,res;			/*18*/
	byte_offset = i >> 3;							/*19*/
	bit_offset = i & 7;							/*20*/
	present = (int)buf[byte_offset];					/*21*/
	if (bit_offset < 6) 							/*22*/
	    res = (present >> (5-bit_offset)) & 7;				/*23*/
	else {
	    present2 = ((int)buf[byte_offset+1]) & 255;				/*24*/
	    res = (present << (bit_offset-5)) & 7;				/*25*/
	    res = res | ((present2 >> (13-bit_offset)));			/*26*/
	}
	return(res);								/*27*/
    }
	
    public drop3 drop_0xx() {							/*28*/
	drop3 resBin;								/*29*/
	int offset=0, res;							/*30*/
	resBin = new drop3(size);						/*31*/
	while (offset < size) {							/*32*/
	    res = this.get_packet(offset);					/*33*/
	    if (res > 3)							/*34*/
		resBin.put_packet_at_end(res);					/*35*/
	    offset += 3;							/*36*/
	}
	return(resBin);								/*37*/
    }

    public void put_packet_at_end(int res) {					/*38*/
	int byte_offset, bit_offset,present;					/*39*/
	byte_offset = size >> 3;						/*40*/
	bit_offset = size & 7;							/*41*/
	size += 3;								/*42*/
	present = (int) buf[byte_offset]; 					/*43*/
	if (bit_offset < 6) {							/*44*/
	    buf[byte_offset]= (byte) (present | (res << (5-bit_offset)));	/*45*/
	}
	else {
	    buf[byte_offset] = (byte) (present | (res >> bit_offset-5));	/*46*/
	    buf[byte_offset+1] = (byte) (res << (13-bit_offset));		/*47*/
	}
    }

    /*==========================================================================*/

    private void write_file(String filename) throws IOException {
	FileOutputStream fos = new FileOutputStream(filename+".java");
	fos.write(buf,0,size/8);
    }
    
    public static void main(String[] args) throws IOException {
	drop3 bin, newbin;
	byte[] buffer;
	int i=0;
	bin = new drop3(args[0]);
	long startTime = System.currentTimeMillis();
	do {
	newbin = bin.drop_0xx();
	i++;
	} while(i<10);
	newbin.write_file(args[0]);
	long stopTime = System.currentTimeMillis();
	System.out.print("" + (stopTime-startTime)/1000.0);
    }    
    

}
	 

