Skip to main content

Proramming question, please help!

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
1 reply [Last post]
hadi99
Offline
Joined: 2011-07-18

Hi Guys,

I was wondering if someone could help me with this issue.

How can I convert numbers to characters in java coding?? In another word, If i have a number like 5000 and I want it to be $5K and 50000 will be $50K and 500000 will be $500K?? Any help please??

Thanks guys.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ViruSpreadeR
Offline
Joined: 2011-07-20

int initialmoney=500000

int money=initialmoney/1000

System.out.println("$"+money+"K")

// im a beginner at java so i think this will do?