diff --git a/Java/Ch 03. Stacks and Queues/Q3_01_Three_in_One/MultiStack.java b/Java/Ch 03. Stacks and Queues/Q3_01_Three_in_One/MultiStack.java index 1bcb43501..421cc2ca3 100644 --- a/Java/Ch 03. Stacks and Queues/Q3_01_Three_in_One/MultiStack.java +++ b/Java/Ch 03. Stacks and Queues/Q3_01_Three_in_One/MultiStack.java @@ -112,7 +112,7 @@ private void shift(int stackNum) { } /* Shift all elements in stack over by one. */ - int index = stack.lastCapacityIndex(); + int index = nextIndex(stack.lastElementIndex()); while (stack.isWithinStackCapacity(index)) { values[index] = values[previousIndex(index)]; index = previousIndex(index);