import java.io.*; import java.util.*; import java.math.*; import java.text.*; public class Fibonacci { public static long fibonacci(long number){ System.out.println("Please enter how many numbers of the Fibonacci Sequence you would like."); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Calendar time = Calendar.getInstance(); try { String input = br.readLine(); int n = Integer.valueOf(input).intValue(); fibonacci(n); } catch (NumberFormatException e){ System.out.println("Don't be silly, that is not an integer!"); } catch (IOException e) { System.out.println("ENTER SOMETHING."); } return number; } }

and this is my recursion code

public class Fibonacci_1 { public static int fib(int n) { int prev1=0, prev2=1; for(int i=0; i<n; i++) { int savePrev1 = prev1; prev1 = prev2; prev2 = savePrev1 + prev2; } return prev1; } public static void main(String[] args) { for (int i=0; i<=46; i++) System.out.println(fib(i)+", "); } }

How do I integrate the recursion inside?