• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 194
  • Last Modified:

numebrs to alphabets in java

hi guys

If i have series of numbers say
1
2
3
4
5
..... and so on

how can i convert that to char format like

a
b
c
d
e
f
..... and so on



so basically
a corresponds to 1
b corresponds to 2
c corresponds to 3
and
so on ...

any one who can provide java code to do that will be greatly appreciated
thanks very much
J

0
jaggernat
Asked:
jaggernat
  • 2
1 Solution
 
CEHJCommented:
char alpha = (char)(i + 'a' - 1);

(where 'i' is your integer)
0
 
keyurkarnikCommented:
You need to take the ascii value of character 'a' which is 97 and then do this :

char val = char(num + 96)

OR for Capital alphabets :

char val = char(num + 64)
0
 
keyurkarnikCommented:
replace num by your integer value
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now