publicstaticvoid init(int src[]) { // Initialize the array for (int i = 0; i < src.length; i++)
src[i] = i;
}
publicstaticvoid shift(int src[]) { //left-shift the array for (int i = src.length - 1; i > 0; i--) { int tmp = src[i];
src[i] = src[i - 1];
src[i - 1] = tmp;
}
}
publicstaticvoid verify(int src[]) { for (int i = 0; i < src.length; i++) { int value = (i - 1 + src.length) % src.length; // correct value after shifting if (src[i] != value) {
System.out.println("Error: src[" + i + "] should be " + value + " instead of " + src[i]);
System.exit(97);
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.