Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 21st, 2007, 8:57 PM   #21
null_ptr0
11 years old
 
Join Date: Nov 2007
Posts: 79
Rep Power: 1 null_ptr0 is on a distinguished road
Re: Decimal to binary help

An efficient, working, version of what I believe your objective is:
java Syntax (Toggle Plain Text)
  1. class BinaryTest {
  2. static String decimaleToBinaryString(int decimal) {
  3. return Integer.toBinaryString(decimal);
  4. }
  5.  
  6. public static void main(String... argv) {
  7. System.console.format("%s", decimalToBinaryString(Integer.parseInt(System.console().readLine("Please enter the decimal integer you would like to convert into a binary string: ")));
  8. }
  9. }

Last edited by null_ptr0; Nov 21st, 2007 at 9:17 PM.
null_ptr0 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
linked list & binary tree questions n00b C++ 14 Nov 4th, 2006 2:24 AM
Java code to convert binary to decimal and hexadecimal to binary prince_haldir Java 1 Mar 7th, 2006 1:51 AM
Binary Ubert Other Programming Languages 8 Sep 23rd, 2005 10:09 AM
binary and ascii Nellie C++ 4 Jun 8th, 2005 1:39 PM
hex and decimal RGB transforming please help cloud- Visual Basic 5 Jan 17th, 2005 3:17 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:44 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC