i besoin d'inverser l'algorithme suivant qui convertit une longue série dans une chaîne:inverse longue série à l'algorithme de chaîne
public final class LongConverter {
private final long[] l;
public LongConverter(long[] paramArrayOfLong) {
this.l = paramArrayOfLong;
}
private void convertLong(long paramLong, byte[] paramArrayOfByte, int paramInt) {
int i = Math.min(paramArrayOfByte.length, paramInt + 8);
while (paramInt < i) {
paramArrayOfByte[paramInt] = ((byte) (int) paramLong);
paramLong >>= 8;
paramInt++;
}
}
public final String toString() {
int i = this.l.length;
byte[] arrayOfByte = new byte[8 * (i - 1)];
long l1 = this.l[0];
Random localRandom = new Random(l1);
for (int j = 1; j < i; j++) {
long l2 = localRandom.nextLong();
convertLong(this.l[j]^l2, arrayOfByte, 8 * (j - 1));
}
String str;
try {
str = new String(arrayOfByte, "UTF8");
} catch (UnsupportedEncodingException localUnsupportedEncodingException) {
throw new AssertionError(localUnsupportedEncodingException);
}
int k = str.indexOf(0);
if (-1 == k) {
return str;
}
return str.substring(0, k);
}
Alors, quand je fais l'appel suivant
System.out.println(new LongConverter(new long[]{-6567892116040843544L, 3433539276790523832L}).toString());
il imprime comme résultat.
Ce serait génial si quelqu'un pouvait dire quel algorithme c'est ou comment je pourrais l'inverser.
Merci pour votre aide
Convertir un 'long []' en un 'String' n'a pas de sens, vous allez devoir expliquer le résultat souhaité plutôt que juste quel est le résultat actuel. – SamTebbs33
Vous ne semblez pas utiliser le reste de la matrice. Seul 'l [0]' est utilisé, c'est donc la seule valeur que vous pouvez espérer recréer. –