java
Write a method that prints out a 3N+1 sequence starting from a given integer, N. Thestarting value should be a parameter to the method. If the parameter is less than or equalto zero, throw an IllegalArgumentException. If the number in the sequence becomes toolarge to be represented as a value of type int, throw an ArithmeticException.
Write a method that prints out a 3N+1 sequence starting from a given integer, N. Thestarting value should be a parameter to the method. If the parameter is less than or equalto zero, throw an IllegalArgumentException. If the number in the sequence becomes toolarge to be represented as a value of type int, throw an ArithmeticException.
ANSWER: