Solved

numebrs to alphabets  in java

Posted on 2007-04-04
5
185 Views
Last Modified: 2010-03-31
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
Comment
Question by:jaggernat
  • 2
5 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 250 total points
ID: 18853992
char alpha = (char)(i + 'a' - 1);

(where 'i' is your integer)
0
 
LVL 12

Expert Comment

by:keyurkarnik
ID: 18866865
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
 
LVL 12

Expert Comment

by:keyurkarnik
ID: 18866886
replace num by your integer value
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Way to decrease size of apk file 9 87
type mismatch (Object[] to double[] 4 33
jboss wildfly 10.1 10 241
restrict decimal places for double datatype 10 22
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question