Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Puffin Rock Characters Plush Toy Set
anil1961
Updated:
Nov 7, 2026
Toyota Vitz scp10 For Sale
Lakmal Bandara
Updated:
Nov 4, 2026
Kandy
Welcome all my all new pet shop Bark.lk
dilumrane
Updated:
Nov 2, 2026
Windows RDP Only Rs.500 a month
Blogerwiki
Updated:
Nov 1, 2026
Ad icon
V2ray VPN for Tunneling
hu KANNA
Updated:
Oct 22, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Help
Need Java Help
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="h_abeysinghe" data-source="post: 12836573" data-attributes="member: 123721"><p>machnla mata podi udawak one Java walin(dan Java mathaka nae ban <img src="/styles/default/xenforo/smilies/default/baffled.gif" class="smilie" loading="lazy" alt=":baffled:" title="Baffled :baffled:" data-shortname=":baffled:" />)</p><p>anyway meka awith BaseConversion ekak <img src="/styles/default/xenforo/smilies/default/D.gif" class="smilie" loading="lazy" alt=":D" title="Big grin :D" data-shortname=":D" /></p><p></p><p>Binary to Decimal and Decimal to Binary Convert karana <img src="/styles/default/xenforo/smilies/default/D.gif" class="smilie" loading="lazy" alt=":D" title="Big grin :D" data-shortname=":D" /></p><p>mama danata haduwe Decimal to Binary witharai, dan mata one Binary to Decimal convert karna..... eth mathaka nae ban karana widiya <img src="/styles/default/xenforo/smilies/default/eek.gif" class="smilie" loading="lazy" alt=":eek:" title="eek :eek:" data-shortname=":eek:" /></p><p></p><p>menna code eka </p><p>[CODE]</p><p>import java.util.*;</p><p>public class BaseConversions</p><p>{</p><p> public static void main (String[] args)</p><p> {</p><p> Scanner input=new Scanner(System.in);</p><p> boolean conv = true;</p><p> String value,binary,decimal1;</p><p> int chosen,decimal,binary1;</p><p> </p><p> do {</p><p> if (conv == true) </p><p> {</p><p> System.out.println("******************************** ");</p><p> System.out.println("Choose What you want to Convert ");</p><p> System.out.println("1.Decimal to Binary(Eg:- 23232 -> 10101)");</p><p> System.out.println("2.Binary To Decimal (Eg:- 10101 ->23232 ");</p><p> chosen = input.nextInt();</p><p> switch (chosen)</p><p> {</p><p> case 1:</p><p> System.out.println("1.Decimal to Binary(Eg:- 23232 -> 10101)");</p><p> System.out.println("Enter positive integer");</p><p> decimal = input.nextInt();</p><p> if (decimal <= 0)</p><p> System.out.println("Entered integer is nonpositive.");</p><p> else {</p><p> binary = "";</p><p> </p><p> while (decimal!= 0) </p><p> {</p><p> if (binary.length() % 5 == 0)</p><p> {</p><p> binary = " " + binary;</p><p> }</p><p> binary = (decimal % 2) + binary;</p><p> </p><p> decimal /= 2;</p><p> </p><p> }</p><p> </p><p> System.out.println("Binary: " + binary);</p><p> }</p><p> break;</p><p> </p><p> case 2:</p><p> System.out.println("2.Binary To Decimal (Eg:- 10101 ->23)");</p><p> System.out.println("Enter the Binary value you want to convert");</p><p> </p><p> </p><p> break;</p><p> </p><p> }</p><p> </p><p></p><p> }</p><p> System.out.println("Do you want to Try again (Y/N): ");</p><p> if (input.next().equalsIgnoreCase("N") )</p><p> conv = false;</p><p> System.out.println("Thank you for using this Program ");</p><p> </p><p> </p><p> }</p><p> while (conv == true);</p><p> }</p><p> </p><p>}</p><p></p><p></p><p></p><p>[/CODE]okata puluwan nam thawa conversions uth dapan.(EG:- Binary to hexa... etc..)</p><p></p><p><img src="/styles/default/xenforo/smilies/default/yes.gif" class="smilie" loading="lazy" alt=":yes:" title="Yes :yes:" data-shortname=":yes:" /><img src="/styles/default/xenforo/smilies/default/yes.gif" class="smilie" loading="lazy" alt=":yes:" title="Yes :yes:" data-shortname=":yes:" /></p></blockquote><p></p>
[QUOTE="h_abeysinghe, post: 12836573, member: 123721"] machnla mata podi udawak one Java walin(dan Java mathaka nae ban :baffled:) anyway meka awith BaseConversion ekak :D Binary to Decimal and Decimal to Binary Convert karana :D mama danata haduwe Decimal to Binary witharai, dan mata one Binary to Decimal convert karna..... eth mathaka nae ban karana widiya :eek: menna code eka [CODE] import java.util.*; public class BaseConversions { public static void main (String[] args) { Scanner input=new Scanner(System.in); boolean conv = true; String value,binary,decimal1; int chosen,decimal,binary1; do { if (conv == true) { System.out.println("******************************** "); System.out.println("Choose What you want to Convert "); System.out.println("1.Decimal to Binary(Eg:- 23232 -> 10101)"); System.out.println("2.Binary To Decimal (Eg:- 10101 ->23232 "); chosen = input.nextInt(); switch (chosen) { case 1: System.out.println("1.Decimal to Binary(Eg:- 23232 -> 10101)"); System.out.println("Enter positive integer"); decimal = input.nextInt(); if (decimal <= 0) System.out.println("Entered integer is nonpositive."); else { binary = ""; while (decimal!= 0) { if (binary.length() % 5 == 0) { binary = " " + binary; } binary = (decimal % 2) + binary; decimal /= 2; } System.out.println("Binary: " + binary); } break; case 2: System.out.println("2.Binary To Decimal (Eg:- 10101 ->23)"); System.out.println("Enter the Binary value you want to convert"); break; } } System.out.println("Do you want to Try again (Y/N): "); if (input.next().equalsIgnoreCase("N") ) conv = false; System.out.println("Thank you for using this Program "); } while (conv == true); } } [/CODE]okata puluwan nam thawa conversions uth dapan.(EG:- Binary to hexa... etc..) :yes::yes: [/QUOTE]
Insert quotes…
Verification
Payakata winadi keeyak tibeda?
Post reply
Top
Bottom