how to use long in string methods like charAt in java??
String s="google";
long i=0;
System.out.println(s.charAt(i));
The maximum Integer value in Java is: 2,147,483,647. Which means that for s.charAt(i)
, i
can have a max value of 2,147,483,647 (2 billion)
Will you really have a string having more than 2 billion bytes of length?
int
is fairly enough.