Solved

numebrs to alphabets  in java

Posted on 2007-04-04
5
181 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

861 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now