Try this:

private static final int findMaxRecursively(List<Integer> numbers, int index, int max) {
    return index >= numbers.size()
        ? max
        : findMaxRecursively(numbers, index + 1, Math.max(numbers.get(index), max));
}

public static final int findMaxRecursively(List<Integer> numbers) {
    return findMaxRecursively(numbers, 0, Integer.MIN_VALUE);
}

public static void main(String[] args) {
    List<Integer> numbers = Arrays.asList(1, -1, 2, -2, 3, -3);
    System.out.printf("Max is %d in %s%n", findMaxRecursively(numbers), numbers);
}
Answer from user4910279 on Stack Overflow
🌐
CodingBat
codingbat.com › java › Recursion-1
CodingBat Java Recursion-1
Recursion strategy: first test for one or two base cases that are so simple, the answer can be returned immediately. Otherwise, make a recursive a call for a smaller case (that is, a case which is a step towards the base case). Assume that the recursive call works correctly, and fix up what ...
Discussions

What's the best way to practice recursion?
I am trying to learn recursion in java and I was wondering if I could find some resources and exercises to help me practice. More on reddit.com
🌐 r/learnjava
13
8
February 4, 2021
java - Recursion exercise - Stack Overflow
I'm new to Java and doing an exercise on recursion. I found this site and I could really use help breaking this down and explaining how this problem would be solved. Does this require the array to be More on stackoverflow.com
🌐 stackoverflow.com
Recursive Methods - Oracle Forums
Hi, I new to java and programming. I'm trying to make sure I have a good handle on how to write recursive methods. I'm looking for some simple problems that can be solved with a recursive method. I'... More on forums.oracle.com
🌐 forums.oracle.com
March 14, 2013
Is recursion a Bad Practice in general? - Stack Overflow
I always thought things that make your code uneasy to follow while being avoidable are considered as Bad Practice. Recursion seems to be one of these things (not to mention the problems it can caus... More on stackoverflow.com
🌐 stackoverflow.com
🌐
GeeksforGeeks
geeksforgeeks.org › dsa › recursion-practice-problems-solutions
Recursive Practice Problems with Solutions - GeeksforGeeks
July 19, 2025 - Mutual Recursion with example of Hofstadter Female and Male sequences · Check if a destination is reachable from source with two movements allowed · Minimum steps to reach a destination · Identify all Grand-Parent Nodes of each Node in a Map · C++ program to implement Collatz Conjecture · Practice Questions for Recursion | Set 1 ·
🌐
Reddit
reddit.com › r › learnjava › comments › lcc3l6 › whats_the_best_way_to_practice_recursion
What's the best way to practice recursion? : r/learnjava
February 4, 2021 - I am trying to learn recursion in java and I was wondering if I could find some resources and exercises to help me practice.
🌐
W3Schools
w3schools.com › java › java_recursion.asp
Java Recursion
Infinite recursion is when the method never stops calling itself. Every recursive method should have a halting condition, which is the condition where the method stops calling itself.
🌐
LeetCode
leetcode.com › problem-list › recursion
Recursion
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
Find elsewhere
🌐
Runestone Academy
runestone.academy › ns › books › published › apcsareview › Recursion › recursionbasics.html
12.1. Recursion — AP CSA Java Review - Obsolete
The AP CS A exam usually has about 4-6 recursion problems. You only need to know how to trace recursive methods (figure out what they return or print).
🌐
Oracle
forums.oracle.com › ords › apexds › post › recursive-methods-4382
Recursive Methods - Oracle Forums
March 14, 2013 - Hi, I new to java and programming. I'm trying to make sure I have a good handle on how to write recursive methods. I'm looking for some simple problems that can be solved with a recursive method. I'...
🌐
CodeHS
codehs.com › practice › java › recursion
Java Practice Problems
Java Practice Problems · Reverse String · Binary Search · Greatest Common Divisor · Least Common Multiple · Recurring Letters · Sum · Sum of Array Using Recursion · Magic Mirror Word Reverser · Recursive Factorial Calculation Back · Still have questions?
🌐
GeeksforGeeks
geeksforgeeks.org › java › recursion-in-java
Recursion in Java - GeeksforGeeks
July 11, 2025 - The classic example of recursion is the computation of the factorial of a number. The factorial of a number N is the product of all the numbers between 1 and N. The below-given code computes the factorial of the numbers: 3, 4, and 5. ... // ...
🌐
Iowa State University
home.engineering.iastate.edu › alexs › classes › 2007_Fall_207 › lab_manual › chapter11_lab.pdf pdf
Chapter 11: Recursion 221 Chapter 11: Recursion Lab Exercises Topics
Printing a string backwards can be done iteratively or recursively. To do it recursively, think of the following specification: If s contains any characters (i.e., is not the empty string) ... File Backwards.java contains a program that prompts the user for a string, then calls method printBackwards to print the
🌐
CodingBat
codingbat.com › java › Recursion-2
CodingBat Java Recursion-2
CodingBat code practice · Recursion-2 chance · Harder recursion problems. Currently, these are all recursive backtracking problems with arrays. Java Example Solution Code · Java String Introduction (video) Java Substring v2 (video) Java String Equals and Loops ·
🌐
DigitalOcean
digitalocean.com › community › tutorials › java-programming-interview-questions
Top Java Coding Interview Questions (With Answers) | DigitalOcean
April 17, 2025 - Focus on common interview topics: Study multithreading, concurrency, and Java-specific topics like serialization and reflection. Prepare to answer behavioral questions: Be ready to discuss your past projects, design decisions, and problem-solving approaches. Practice whiteboarding: Practice explaining technical concepts and designing systems on a whiteboard.
🌐
Learncs
learncs.online › lessons › java › practicewithrecursion
Learn CS Online: Practice with Recursion
Our suggestion is to have toMap create the map and then call a private recursive helper method to populate it. If the tree passed to toMap is null you should throw an IllegalArgumentException. You will need to import cs125.trees.BinaryTree, as well as Map and a Map implementation (probably HashMap) from java.util. We've provided some code to get you started. For reference, cs125.trees.BinaryTree has the following public properties: ... Need more practice?
🌐
Quora
quora.com › Where-can-I-find-many-questions-to-practice-on-recursion-and-file-handling-in-C-or-C++-or-Java
Where can I find many questions to practice on recursion and file handling in C or C++ or Java? - Quora
Answer (1 of 6): Its add-on to the above answers…. I would like to suggest you to master Data Structures & Algorithms and techniques as much as possible rather than practising questions on particular topics. I am not saying that…you are doing wrong ! Few suggestions are 1) Try to perfect any o...
🌐
w3resource
w3resource.com › java-exercises
Java programming Exercises, Practice, Solution - w3resource
The best way we learn anything is by practice and exercise questions. Here you have the opportunity to practice the Java programming language concepts by solving the exercises starting from basic to more complex exercises. It is recommended to do these exercises by yourself first before checking ...