About binary number and decimal number?

how to use a class to convert a decimal number from a binary number?Thank you

You've already asked the same kind of thing before (http://forum.java.sun.com/thread.jsp?forum=31&thread=325249), and fsato4 answered. Here is the same thing, but decimal to binary.
public class ToBinary {
     public static void main(String[] args) {
          int n = 12; 
          System.out.println(Integer.toString(n)); 
          System.out.println(Integer.toBinaryString(n));

Similar Messages

  • HT2534 My friend created me an itunes store account with his credit card , his credit card is about to expire and they are asking me to re-enter the credit card and security card number .... I don't have these numbers ... How can i create new itunes accou

    My friend created me an itunes store account with his credit card , his credit card is about to expire and they are asking me to re-enter the credit card and security card number .... I don't have these numbers ... How can i create new itunes account without credit card?????

    Why do you need to create a new account?
    Just change the payment method.
    http://support.apple.com/kb/ht1918

  • I put my sim in someone's phone earlier for about 3 minutes, and now they are receiving my iMessages and can't remive my number from their settings, pls help

    I put my sim in someone's phone earlier for about 3 minutes, and now they are receiving my iMessages and can't remive my number from their settings, pls help

    They need to turn off iMessage, power the phone off/on, then activate iMessage again with their SIM.

  • Serial Number in About This Mac and System Profiler says "System Serial#"

    I recently had my hard drive and motherboard replaced under warranty.
    I wanted to check the expiration of my warranty so I could buy AppleCare before my year is up. I went first to About This Mac, and then to System Profiler - both of them say my Serial Number is "System Serial#" - any ideas on how to get my real serial number displayed?

    How strange! I'm not sure if this will show anything different, but you can also try to get the serial number via Terminal. Just open the Terminal application and copy in this command:
    ioreg -l | grep IOPlatformSerialNumber

  • What is the difference between number, numeric, dec and decimal

    hello
    i want to ask what is the difference betwen number, numeric, dec and decimal data types ?
    in this paper http://www.techonthenet.com/oracle/datatypes.php
    i see that there is no difference ?
    what is the trick here - why there are 4 type with one purpose?

    Generally speaking Oracle has specific names for their own data types. Additionally they support the ANSI names (as well as others) for some data types which are then converted to the equivalent Oracle data type. See the documentation for details.
    ANSI, DB2, and SQL/DS Data Types

  • Add leading 0's to binary number

    hi,
    i am learing labview and i wanted to do something like this..
    i want to read in a text file.
    convert the decimal numbers to binary numbers
    and then add leading zeros if the lenght of the binary is less than X number.
    and then ultimately sum up all binary numbers and parse it into 1 bits as 1 array.
    the reason for me doing this because i am generating a singal.
    i have started on this, but i am stuck at the comments, can someone help me out. 
    thank you in advance..
    Message Edited by Giangliang on 04-02-2009 06:54 PM
    Solved!
    Go to Solution.
    Attachments:
    Array_v4.vi ‏45 KB
    example.txt ‏3 KB

    Can you show us your final version? Your v6 is sitll an absolute mess.
    Most of your code is very inadequate and overly complicated. None of your shift registers make any sense, you can delete the (1) shift registers, (2) index array, (3) insert into array (4) initialize array, etc. and replace all with two simple autoindexing tunnels.
    I still don't quite understand what you need, but my best guess is that it can be done with code the size of a postage stamp.
    To count the number of "1" bits in an array of numeric intergers, you can use e.g. a 16 bit lookup table, no strings or formatting operations needed. It will be many orders of magnitude faster and simpler. All you need is blue wires.
    Please show us the final version that gives the correct and desired result so we can show you how to do this right.
    LabVIEW Champion . Do more with less code and in less time .

  • I recently had a break-in - Question about serial number

    I recently had a break-in and my iPad, iPad mini and iPod Touch were stolen.  I was able to retrieve the serial number for the iPad and iPod Touch, but the iPad mini doesn't show up as one of my devices owned.  I've had it for about 6 months and I know it was registered.  It was also on my iCloud.  I cannot find it either place now.  Could the thieves have done something to it to remove it from my account?  Also, who can I contact at Apple to see about getting the serial number for this stolen item?  Thanks in advance for any and all help!

    If the iPad was running iOS 7, the thief/finder will not ever be able to use it.
    iCloud: Find My iPhone Activation Lock in iOS 7
    http://support.apple.com/kb/HT5818
    Apple (and no one else) can not assist (with serial number or iCloud) in finding a lost or stolen iPad.
    Report to police along with serial number. Change all your passwords.
    These links may be helpful.
    How to Track and Report Stolen iPad
    http://www.ipadastic.com/tutorials/how-to-track-and-report-stolen-ipad
    Reporting a lost or stolen Apple product
    http://support.apple.com/kb/ht2526
    What to do if your iOS device is lost or stolen
    http://support.apple.com/kb/HT5668
    iCloud: Locate your device on a map
    http://support.apple.com/kb/PH2698
    iCloud: Lost Mode - Lock and Trace
    http://support.apple.com/kb/PH2700
    iCloud: Remotely Erase your device
    http://support.apple.com/kb/PH2701
    Report Stolen iPad Tips and iPad Theft Prevention
    http://www.stolen-property.com/report-stolen-ipad.php
    General steps to follow for a Stolen iPad
    http://stolen-ipad.com/
    How to recover a lost or stolen iPad
    http://ipadhelp.com/ipad-help/how-to-recover-a-lost-or-stolen-ipad/
    How to Find a Stolen iPad
    http://www.ehow.com/how_7586429_stolen-ipad.html
    What NOT to do if your iPhone or iPad is lost or stolen
    http://www.tomahaiku.com/what-not-to-do-if-your-iphone-or-ipad-lost-or-stolen/
    Apple Product Lost or Stolen
    http://sites.google.com/site/appleclubfhs/support/advice-and-articles/lost-or-st Len
    Oops! iForgot My New iPad On the Plane; Now What?
    http://online.wsj.com/article/SB10001424052702303459004577362194012634000.html
    If you don't know your lost/stolen iPad's serial number, use the instructions below. The S/N is also on the iPad's box.
    How to Find Your iPad Serial Number
    http://www.ipadastic.com/tutorials/how-to-find-your-ipad-serial-number
    iOS: How to find the serial number, IMEI, MEID, CDN, and ICCID number
    http://support.apple.com/kb/HT4061
    Check the serial number (located on back/bottom) in this lost/stolen iPad database. However, most owners are not aware of this database and don’t enter the serial number.
    Stolen iPad Database
    http://www.stolenlostfound.org/online-stolen-ipad-database
    Also do a search, using the serial number, on your local Craig’s List. Some users list the serial number of a stolen iPad to thwart the sale of a stolen device.
     Cheers, Tom

  • What is it about the number "3" ?

    Anyone remember these?
    Apple III
    Macintosh OS 3g
    Windows 3.01
    I tell you there is something about the number 3 that causes havoc with computer systems. Seems we should just skip over it and move on to Aperture 4... someone call me when it is ready.
    Just a little levity to distract you while you wait for Aperture 3.0+ to finish Finding Faces and Processing... whatever that is.

    You forgot:
    CS3
    1d MarkIII
    In the meantime, turn off faces and "automatically generate previews"

  • Binary Number Permutation algorithm?

    Hi guys, I want to find all the permutations of a binary number, for example 00001111 . does anyone have some algorithm to do this ? ( without allowing duplicates of course... that's why it's binary anyway )
    Any help would be awesome.

    That'll work but it's rather slow. This algorithm will generate all r-element subsets of [n] in colex order in time O(n^r O(P(\log n))) and space O(r O(P(\log n))):
    1) the first set in the sequence is {1,...,r}
    2) given a set S={x[1],...,x[r]} with x[1] < ... < x[r]:
    - if S={n-(r-1),...,n}, this is the last set in the sequence;
    - otherwise, if x[i1]=x1 for i=1,...,j-1 (j>=1) and x[j+1] >= x[j]+2, the next r-element subset of [n] in the sequence is {1,...,j-1,x[j]1,x[j+1],x[j2],...,x[r]}
    Generate the r-element subsets of [n] and then or the corresponding bits to get your binary numbers.

  • SMP3: What about licensing & Number of device registrations?

    Hi All,
    As we all know that SMP3 SP03 is GA now. And most of us have started working on the same. While installation of SMP3 SP03 runtime, it does not ask about license type like the way we have seen while installing of SMP2.3 or earlier version (SUP 2.x)
    e.g.
           For Personal Developer Edition: Allows a max of 5 client devices
           For Enterprise Developer Edition:Allows a max of 20 client devices and so on.
    As per current SMP3 binaries, a single downloaded SMP3 setup can be installed on as many number of machines. What could be the SAP's objective if there is no such license type information available for server installation?
    How we will ensure about max number of client devices registration against a particular server?
    Regards,
    JK

    I've asked the person who is seeing 38 digits to test. I'll report the results.
    Somebody else tried the copy/paste method too and it gave 40 digits, but she was also seeing 40 digits in iTunes.
    It seems some people are just seeing 38 digits in iTunes, so the thing to confirm still is whether or not those people can successfully copy/paste all 40 digits.
    Thanks,
    doug

  • Converting a binary number to a list of integers

    I need to convert a binary number to a list of the values of the bit possitions that make up that number. I.e. 1 = 1; 3=2,1; 7=1,2,4.
    Does anyone know of Java API functions that could accomplish this, I couldn't find any, or a function that can do this?

    This reminds me of my programming homework assignments...
    There are some very efficient ways to do this - but I can't remember them off the top of my head. I can guarantee they will have been posted several hundred times before. This will work:
    class BitMask {
        private byte mask = 1;
        public void printBitFields(int a) {
         System.out.print(a + " =");
         for(i = 0 ; (a & Integer.MAX_VALUE) != 0 ; i++) {
             if((a & mask) == 1)
              System.out.print(" " + ((int) java.lang.Math.pow(2,i)));
             a >>= 1;
         System.out.println();
        public final static void main(String args[]) {
         BitMask bm = new BitMask();
         bm.print(1);
         bm.print(18);
         bm.print(19); // etc...
    }

  • How to transmit binary number by using USRP example QAM TX

    Hello:  now my project is build up a wireless communication system by using QAM,there is one really good example in the modulation toolkit,but what should I do if I want to know exactly the message I am transmitting for example binary number?Which part should I modify in the example?Thanks.

    See this example:  Packet Based Digital Link  https://decibel.ni.com/content/docs/DOC-18801

  • Append each bit to the binary number (Not Array Indicator)

    Hi All
    If i have the 8 Number control. Each Control represent each bit.
    i.e. 0th control bit="1", 1th control bit="0", other bit = "0"....7th control bit ="1".
    How to output the 1 binary number indicator. -->10000001
    Thanks
    Best Regards,
    Steve

    I had solved it.
    i use true/false case to multiply each bit interial.
    i.e. For 8 th bit. If =0, output to 0, if =1 (i.e not equal to 0), output 10000000
          For 7 th bit. If =0, output to 0, if =1 (i.e not equal to 0), output 1000000
    Final, use "OR" function to build into 1 binary number.
    Please refer the attached graph.
    Anyway, have the other fast way to do this result??
    Thanks
    Steve
    Attachments:
    Each Bit to build-in 1 indicator.jpg ‏71 KB

  • Same pseudo random binary number on two different laptops

    I want to generate same pseudo random binary number on two different laptops at the same time.
    How can I do that. Please provide suggestions.  
    JK

    Hi Joseph,
    I don't have any examples of this. Usually you use PRNGs to generate unique numbers…
    You need to create your own algorithm.
    There are USB sticks available that generate unique numbers in a certain reproducable way, which are used for authentification of bank account operations. You might take them as inspiration for your task…
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Binary numbers to decimal numbers

    Hello, Im writing a program that changes binary numbers to decimal numbers. I seem to be having a probelm calculating the last number in the binary code and adding it to the total. Also, when I use large binary numbers the output isnt anywhere near correct. help? please? thank you

    public class binarynumbers
    public static void main (String [] args)
    int decimal=0;
    Scanner scan= new Scanner(System.in);
    System.out.print("enter binary number> ");
    String bin=scan.next();
    int zero=0;
    int one=1;
    int length=bin.length();
    int newlen=length-1;
    while (newlen>=0)
         String number = bin.substring( zero , one );
         int number1=Integer.parseInt(number);
         int squareRoot=Math.pow(2,newlen);
         decimal+=(squareRoot*number1);
         newlen--;
         zero++;
         one++;
    System.out.println("The decimal number translation is " + decimal);
    i did that but the math part isnt working and im getting a message like this
    binarynumbers.java:26: possible loss of precision
    found : double
    required: int
         int squareRoot=Math.pow(2,newlen);
    ^
    1 error

Maybe you are looking for

  • Apple ID / iCloud - Cannot verify email address , maybe used in a different account?

    Hi all! Until last week I was having a Family Account on MobileMe. Now that I have transferred all sub accounts to iCloud I moved the main account, too. All sub accounts are working fine and the can use all services like Find my Friends. Now after ha

  • Error while trying to access dashboards from EPM

    Hi We integrated OBIEE 10.1.3.4 with EPM 11.2 and when we are trying to access dashboards from EPM we are facing the following error : "Invalid or could not find module configuration." Please , help us in solving the above issue. Thanks.

  • Queries on HBase

    Hi, I have queries on HBase, Is there any document to restore the HBase table created on older cluster to new created cluster Regional Servers are nodes which contains partitioned data will be Azure blob Storage, will there be nearer to table storage

  • How to storing more than 1 data to vector

    hi, I would like to know if I can store the following: select field1, field2, field3 from tableA can I store this above data and return the values to jsp page and later used this in either jsp / java file. in the jsp file I will need to display only

  • URL Rewriting in JSF 1.2

    Hello, I am new to JSF. I am using JSF 1.2. I basically need URL rewriting in my JSF pages. I need to rewrite all Links in JSF by which jsessionid will attached to links in similar way to html:rewrite/html:link in struts . How do i achieve this in JS