I have a huge set of strings, where I want to find the length of the each string and add them and display the total length of string.
To calculate the length, I use method as
However my string object have characters more then 2,147,483,647
I doubt it: a String uses a
char to store the characters and arrays can't hold more than
Integer.MAX_VALUE elements. See also this post.
If you simply need to add the lengths of several strings, you can use a long variable instead.