Flash Website Builder- Trendy Site Builder is a Flash Site Building tool that helps users build stunning websites. Check Out Custom Custom Logo Design by LogoBee. Website Design and Free Logo Templates available.
 CodingForums.com Binary number to a decimal equivalent

Before you post, read our: Rules & Posting Guidelines

Enjoy an ad free experience by logging in. Not a member yet? Register.
 03-19-2012, 05:04 AM PM User | #1 shadefire New to the CF scene   Join Date: Mar 2012 Posts: 1 Thanks: 0 Thanked 0 Times in 0 Posts Binary number to a decimal equivalent Hello, I started java a few weeks ago for my programming class, and I got this assignment where I had to convert a binary number to an integer, or its decimal equivalent. We are not allowed to use shortcuts to convert a binary to a decimal, or import anything other than java.io.*; I know how the binary system works, but I just don't know how to implement it and make it into a program using java. Does anybody have any idea how I can approach this problem? Any help is appreciated thanks.
 03-20-2012, 09:25 AM PM User | #2 smithdavid New to the CF scene   Join Date: Mar 2012 Posts: 4 Thanks: 0 Thanked 0 Times in 0 Posts I know the simple coding, import java.lang.*; import java.io.*; public class DecimalToBinary{ public static void main(String args[]) throws IOException{ BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter the decimal value:"); String hex = bf.readLine(); int i = Integer.parseInt(hex); String by = Integer.toBinaryString(i); System.out.println("Binary: " + by); } }

 Bookmarks

 Thread Tools Rate This Thread Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 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 Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home :: Client side development     JavaScript programming         DOM and JSON scripting         Ajax and Design         JavaScript frameworks         Post a JavaScript     HTML & CSS     XML     Flash & ActionScript         Adobe Flex     Graphics and Multimedia discussions     General web building         Site reviews         Building for mobile devices :: Server side development     Apache configuration     Perl/ CGI     PHP         Post a PHP snippet     MySQL         Other Databases     Ruby & Ruby On Rails     ASP     ASP.NET     Java and JSP     Other server side languages/ issues         ColdFusion         Python :: Computing & Sciences     Computer Programming     Computer/PC discussions     Geek News and Humour Web Projects and Services Marketplace     Web Projects         Small projects (quick fixes and changes)         Medium projects (new script, new features, etc)         Large Projects (new web application, complex features etc)         Unknown sized projects (request quote)         Vacant job positions         Looking for work/ for hire         Project collaboration/ partnership         Paid work offers and requests (Now CLOSED)     Career, job, and business ideas or advice     Domains, Sites, and Designs for sale         Domains for sale         Websites for sale         Design templates and graphics for sale :: Other forums     Member Offers     Forum feedback and announcements

All times are GMT +1. The time now is 06:51 PM.