Skip to content

Commit d142193

Browse files
Fixed negative permutations.
1 parent 3dfebae commit d142193

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

biojava3-core/src/main/java/org/biojava3/core/util/SequenceTools.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ public static String permuteCyclic(String string, int n) {
3737
*/
3838
public static <T> void permuteCyclic(T[] array, T[] fill, int n) {
3939
if (array.length != fill.length) throw new IllegalArgumentException("Lengths do not match");
40-
while (n < 0) {
41-
n += array.length;
42-
}
40+
if (n < 0) n = array.length + n;
4341
while (n > array.length) {
4442
n -= array.length;
4543
}

0 commit comments

Comments
 (0)