I want to find a character in a specific position on a very large line. However, I cannot use the charAt() method because the range exceeds the value for int. Do you have such a setting?
charAt()
In Java, strings have character array support. The theoretical size of the array is limited by the maximum int value, so it is impossible to create a string with more than 2 characters 31 -1.
int
To overcome this problem, you can create your own string class that uses multiple arrays or strings as storage.
Take only a shorter substring from a large string and get access to the corresponding position?
Since String is internally represented by an array of characters, its maximum length cannot be greater than the size of int. Therefore, in the first place, you cannot have a String exceeding the range of int.