how to find length of string without using string method in java