public static String crypt(BigInteger n,BigInteger e, String msg1)
    {
     int fp=0,lp=32,j=0,i,c=0;
     BigInteger encod[]=new BigInteger[1000000];
     BigInteger encry[]=new BigInteger[1000000];
     String binary="";
     String coded=new String();
     String sixteen[]=new String[1000000];
     String str="";
     for(i=0;i<msg1.length();i++)
     {
     binary=Integer.toBinaryString(msg1.charAt(i));
     for(j=binary.length();j<8;j++)
         binary="0"+binary;
     str=str+binary;
     if(i%4==3)
     { sixteen[c++]=str.substring(fp,lp);
     fp=lp;lp=lp+32;}

     }
    if(i%4!=0)
     { sixteen[c++]=str.substring(fp,str.length());
       for(j=sixteen[c-1].length();j<32;j++)
           sixteen[c-1]="0"+sixteen[c-1];
    }
     for(i=0;i<c;i++)
     {
         encod[i]=new BigInteger(sixteen[i].toString(), 2);
         encry[i]=encod[i].modPow(e,n);
         //System.out.println(sixteen[i]+" \t "+encod[i]+" \t "+encry[i]);
         binary=Integer.toBinaryString(encry[i].intValue());
         for(j=binary.length();j<32;j++) binary="0"+binary;
         //System.out.println("okoii"+binary);
         //System.out.println(Integer.parseInt(binary.substring(0,8),2));
         for(j=0;j<32;j+=8)
        coded=coded+(char)Integer.parseInt(binary.substring(j,j+8),2);
  }
        //System.out.println("The binarytext is \""+binary+"\"");
//        System.out.println("The ciphertext is \""+coded+"\"");
        return(coded);
    }