1 import java.lang.reflect.Array;
2
3 import java.util.*;
4
5 public class Main {
6
7 public static void main(String[] args) {
8
9 Scanner sc=new Scanner(System.in);
10
11 String s=sc.nextLine();
12
13 int a[]=new int[Integer.valueOf(s)];
14
15 for (int i=0;i<a.length;i++){
16
17 String str=sc.nextLine();
18
19 if (Character.isDigit(str.charAt(0))){
20
21 a=Integer.valueOf(str);
22
23 }else {
24
25 System.out.println("java.lang.NumberFormatException: For input string: \""+str+"\"");
26
27 i--;
28
29 }
30
31 }
32
33 System.out.println(Arrays.toString(a));
34
35 }
36
37 }
import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n=scan.nextInt();
int a[]=new int[n];
int count=0;
while(count<n) {
try {
String temp=scan.next();
int i=Integer.parseInt(temp);
a[count++]=i;
}catch(Exception e) {
System.out.println(e);
}
}
System.out.println(Arrays.toString(a));
scan.close();
}}
import java.util.Scanner;
class ArrayUtils{
public static double findMax(double[] arr,int begin, int end)throws IllegalArgumentException{
if(begin>=end) {
throw new IllegalArgumentException("begin:"+begin+" >= end:"+end);
}
else if(begin<0){
throw new IllegalArgumentException("begin:"+begin+" < 0");
}
else if(end>arr.length){
throw new IllegalArgumentException("end:"+end+" > arr.length");
}
double max=0;
for(int i=begin;i<end;i++){
if(max<arr)
max=arr;
}
return max;
}
}
public class Main{
public static void main(String argn[]){
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
double[] arr =new double[n];
for(int i=0;i<n;i++){
arr=scan.nextInt();
}
while(true){
int begin,end;
int m=0;
ArrayUtils hsj[] =new ArrayUtils[100];
hsj[m++]=new ArrayUtils();
try{
begin = Integer.parseInt(scan.next());
end = Integer.parseInt(scan.next());
} catch(NumberFormatException e){
break;
}
try {
System.out.println(hsj[m].findMax(arr,begin,end));
} catch (IllegalArgumentException e) {
System.out.println(e.toString());
}
}
try {
System.out.println(ArrayUtils.class.getDeclaredMethod("findMax", double[].class,int.class,int.class));
} catch (Exception e1) {
}
}
}