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
එක පැකේජ් එකයි මාසෙටම Unlimited Internet. තාමත් DATA CARD දාන්න සල්ලි වියදම් කරනවද? අඩුම මිලට අපෙන්.
sayuru bandara
Updated:
Tuesday at 12:30 PM
Ad icon
ඉන්ටර්නෙට් එකෙන් හරියටම සල්ලි හොයන්න සහ Success වෙන්න කැමතිද? 🚀 (E-Money & Success Stories)
siri sumana
Updated:
Saturday at 11:44 PM
Gemini AI PRO 18 months Offer
Hawaka
Updated:
May 27, 2026
Ad icon
koko account
DasunEranga
Updated:
May 27, 2026
Ad icon
koko account
DasunEranga
Updated:
May 27, 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
Nawa warak dahaya keeyada? (Namaya wadi kireema dahaya)
Post reply
Top
Bottom