How to map character to numeric position in java?

Use the indexOf method on a String object. For example,

"ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf('F')

returns 5.

Leave a Comment