0

I want to convert 1 to 'A' and 2 to 'B' and so on. Is there a specific formula in java for capital letters?

user180505
  • 25
  • 4
  • possible duplicate of [Convert string to ASCII value in java](http://stackoverflow.com/questions/16458564/convert-string-to-ascii-value-in-java) – Tom Feb 17 '15 at 17:54

1 Answers1

7

Sure, (char) ('A' + n - 1) will map the integers from 1 to 26 to the characters 'A' to 'Z'.

Louis Wasserman
  • 191,574
  • 25
  • 345
  • 413