hi all ..i have a problem with my project and need your help plz ...
i have this code

int [] exp = {32,1,2,3,4,5,4,5,6,7,8,9,8,9,10,11,12,13,12,13,14,15,16,17,16,17,18,19,20,21,20,21,22,23,
24,25,24,25,26,27,28,29,28,29,30,31,32,1};
                                          int [] expword =  new int [exp.length];
                                          String s=toenc.getText();
                                          if(s.length() < 32)
                                             JOptionPane.showMessageDialog(null,"Word must be 32");
                                          else{
                                             int[] e = new int[s.length()];
                                             for (int i = 0; i < s.length(); i++) { 
                                                e[i] = Character.digit(s.charAt(i), 10);
                                             }

s is the string that i enter in the text field ...i'am entering serie of (32 bit ) in binary and then i transform them to (int []) ...
i want to extend these bits to become 48 bit by the way shown in the (exp array) for example i want the bit in the index(4 and 5) in the (int [] )to be typed 2 times (4 5 4 5) and soo on as shown in the (exp table) and i want them to be in a new table of 48 bits extended from the original table ...and thnx for help in advance

no one can help me :S:S ..ok thnx ....i found out a way ...if someone is interested ..i'll post my code .

Please share =)

It looks like I could have helped, your explanation is quite confusing though. What I don't get is why you don't simply post an example of what you are trying to accomplish. For example,

I'm trying to transform 1 into 2
1. array that holds: 1 2 3 4 5
2. array that holds: 1 1 2 2 3 3 4 4 5 5

int  []sub1 = {14,4,13,1,2,15,11,8,3,10,6,12,5,9,0,7,0,15,7,4,14,2,13,1,10,6,12,11,9,5,3,8,4,1,14,8,13,6,2,11,15,12,8,7,3,10,5,0,15,12,8,2,4,9,1,7,5,11,3,14,10,0,6,13};
                                          int []sub2 = {15,1,8,14,6,11,3,4,9,7,2,13};
                                          String ke =keyfield.getText();
                                          int [] exp = {32,1,2,3,4,5,4,5,6,7,8,9,8,9,10,11,12,13,12,13,14,15,16,17,16,17,18,19,20,21,20,21,22,23,24,25,24,25,26,27,28,29,28,29,30,31,32,1};
                                          int [] expword =  new int [ke.length()];
                                          String s=toenc.getText();
                                          int[] e = new int[s.length()];
                                          int[] k = new int[ke.length()];
                                          int [] resxor = new int [ke.length()];
                                          if((ke.length() < 48) || (ke.length() >48))
                                             JOptionPane.showMessageDialog(null,"key must be 48");
                                       
                                          for (int j = 0; j < ke.length(); j++) {
                                             k[j] = Character.digit(ke.charAt(j), 10);     //tableau contenant le key en binaire
                                          	//transform key to int [];
                                          //System.out.print("k"+ j + "=" +k[j] + "\n");
                                          }
                                       
                                          if((s.length() < 32) || (s.length() >32))
                                             JOptionPane.showMessageDialog(null,"Word must be 32");
                                       
                                       
                                          for (int i = 0; i < s.length(); i++) { 
                                             e[i] = Character.digit(s.charAt(i), 10);    //tableau contenant le plain text en binaire
                                          	//transform word to int [];
                                             //System.out.print("e "+ i + "=" +e[i] + "\n");
                                          }
                                             //System.out.println("-------------------------");
                                            // for(int j=0;j<e.length;j++)
                                          for(int ss=0;ss<exp.length;ss++){
                                             expword[ss] = e[exp[ss]-1];   // expansion of plain text from 32 to 48;
                                               // System.out.print("expword "+ss + "=" +expword[ss] + "\n");
                                          }
                                          for(int q=0;q<k.length;q++){    //pour calculer XOR.
                                             resxor[q] = expword[q] ^ k[q];
                                               // System.out.print("resxor["+ q +"]=" +resxor[q]+"\n");
                                          }
                                          for(int r=0;r<rexor.length;r++){
                                             if((r!=0) && (i%8==0))
                                                k++;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.