decoupage

This commit is contained in:
Lucàs
2022-09-27 15:13:04 +02:00
parent 94f33aeb3a
commit 87e283893f
2 changed files with 26 additions and 1 deletions
+18
View File
@@ -92,6 +92,24 @@ public class Des {
System.arraycopy(newTab, 0, bloc, 0, newTab.length);
}
public static int[][] decoupage(int[] bloc, int nbBlocs) {
if(bloc.length % nbBlocs == 0) {
int z = bloc.length / nbBlocs;
int [][] newTab = new int[nbBlocs][z];
int y = 0;
for (int i = 0; i < bloc.length ; i++) {
if (i % z == 0 && i > 0) {
y++;
}
newTab[y][i - y * z] = i;
}
return newTab;
}
return null;
}
private static int[] crypte(String message_clair) {
// int[] msg_crypte = message_clair.byt
return null; // Todo Bouchon
+8 -1
View File
@@ -53,11 +53,18 @@ public class testDes {
System.out.println(Arrays.equals(bloc, bloc2));
}
public static void testDecoupage() {
System.out.println(Arrays.deepToString(Des.decoupage(new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19}, 4)));
}
public static void main(String[] args) {
// testStringToBits();
// testBitsToString();
// testGenerePermutation();
// testPermuation();
testInvPermuation();
//testInvPermuation();
testDecoupage();
}
}