Dividin an Int into Digits

Hey i a trying to divide an integer that i am reading from he keyboard
IE: 459874
into an array of integers
int Array[]={4,5,9,8,7,4}
Is there a native function in java that might allow me to do that? Or am i gona have to read into a string and then use the tokenizer?
Any help is appreciated

Is there a native function in java that might allowDo you really mean native? Or do you mean a java function that's part of the java standard package library
me to do that? Or am i gona have to read into a
string and then use the tokenizer?Yes you are going to have to do it yourself. But don't use a tokenizer. it's much simpler than that.

Similar Messages

  • Separating user-entered int into digits

    For example, if the user enters "123", separate it to 1, 2, 3. I've tried converting the int to a String and using charAt, and I've tried dividing: %10 and /10.
    Here is my current charAt attempt:
    public static void main(String[] args) {
              Scanner keyboard = new Scanner(System.in);
              System.out.print("What is the number? " );
              int num = keyboard.nextInt();
              String numString = String.valueOf(num);
            int numLength = numString.length();
          while (numLength >= 1) {
            int dig = (numString.charAt(numLength)) - 48;
              System.out.println(dig);
            int newNumLength = numLength --;
            dig = (numString.charAt(newNumLength)) - 48 ;
            System.out.println(dig);}
         }I was using - 48 because at first it was working for getting the first digit in the int.

    If your String is "123", then your first character is '1', and you just want to print out the '1'. There's no need for the -48 part.
    Try this:
    int i1 = 48;
    int i2 = '0';
    System.out.println(i1);
    System.out.println(i2);
    char c1 = 48;
    char c2 = '0';
    System.out.println(c1);
    System.out.println(c2);Edited by: jverd on Apr 11, 2011 5:18 PM
    Edited by: jverd on Apr 11, 2011 5:19 PM

  • HT1351 I've encoded a vinyl LP record into digital format and recorded it onto an usb as MP3 file. But when I tried to copy it onto my ipod classic, I get a message stating "was not copied to the ipod because it cannot be played on this ipod". Why?

    I've encoded a vinyl LP record into digital format and recorded it onto an usb as MP3 file. But when I tried to copy it onto my ipod classic, I get a message stating "was not copied to the ipod because it cannot be played on this ipod". Why?

    I was refering to the "sample rate", normally 44.1 KHz, the iPod might not be able to play tracks with a non-standard rate. Otherwise I'm not sure what the issue might be.
    tt2

  • How can i change analog waves into digital waves?

    we had labview lab last week.. were doing fine if we have instructions unfortunately the professor will give us an exercise regarding baseband signals spectra.. were trying to download a trial software but we dont have any luck. the question asks for us to change analog waves into digital waves, measure the amplitude of the 5-th harmonic using spectrum analyzer.. i hope you can help me thnx..

    After you are successful getting LabVIEW on your computer, put together something to at least show us you're up for learning.  Then we can guide you to a solution that you've developed (mostly) on your own. 
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

  • Great....upgraded my bundle and was forced into digital voice. Now I've lost my 2nd phone line

    I'm beyond frustrated yet again with Verizon and trying to do an upgrade.  I upgraded my bundle and was forced into digital voice. Really didn't care to change my phone but went ahead.   So today I wake up to no 2nd phone line or distinctive ring line.  I've spent 2+ hours on the phone trying to get someone to get my phone line back and I'm so sick of being transferrred, calls dropped, wrong department, etc.  I don't have time for this **bleep**!  Plus...the online chat isn't working either.  I give up! 
    If there is a tech person out there that can help me get my line back....please tell me who the heck to call without getting a one hour + run around with no help!
    Deanne
    Frustrated in Keller

    I'm sorry to hear about your phone upgrade issue. The Verizon Forums is a peer-to-peer support channel in which users help other users. Because your issue appears to need account specific assistance from Verizon, I've moved your message to an employee monitored board, where a Verizon representative can assist you. You will be contacted by email, private message in the Forums and/or the billing telephone number on your Verizon account as soon as possible.
    If a forum member gives an answer you like, give them the Kudos they deserve. If a member gives you the answer to your question, mark the answer that solved your issue as the accepted solution.

  • Convert scanned handwriting (raster) into digital ink (vector)

    Do any of the Adobe products (or any other software) convert raster based images into vector... specifically I am wanting to convert pages of scanned handwriting into digital ink (NOT editable text).  I will then use a suitable tablet and stylus to add/remove handwritten words to the digital ink text. I have been using Onenote and a Surface Pro and stylus to generate handwritten text but have a number of existing manually handwritten pages that I would like to convert to digital ink and then modify in Onenote or some other suitable program.

    illustrator, indesign, flash, shape and probably several other adobe products can convert rasters to vectors.

  • Converting sequence of anlaog pulses into digital pulses

    Hello,
    I am working to detect the peaks in a particular interval of time say 'x'. I acquired the analog signals( the pulses) as shown in the image here AcquiredPulse from analog board using DAQ.Before detecting the peaks of the pulses of different amplitudes having nearly same time period shown in the above image I want to convert them into digital pulses or pulses of same amplitude so that it will be easy for the post process of detecting peaks.And after obtaining this I need to find out the time interval between the pulses.
    Can any one help me with implementation of this.
    Solved!
    Go to Solution.

    By this Vi you can convert the waveform
    Vara Prasad A
    Kudos are Accepted
    Attachments:
    analog to digital.vi ‏14 KB

  • Getting Audigy Ex Platinum back into Digital out mo

    OK, I rebuilt my computer this weekend, and one problem remains. Everything worked fine before with my Audigy and Klipsch 5. system, running in digital mode. Everything is installed (physically) the exact same. I CANNOT for the life of me get the audigy into Digital Output mode again
    !!! I read this KB article and know this is exactly my problem:[url="]http://dmzweb3.europe.creative.com/SRVS/CGI-BIN/WEBCGI.EXE/,/?St=885,E=000000000066343529,K=27,Sxi=8,Case=obj(3 062),Kb=ww_english_add,VARSET=ws:http://us.creative.com/[/url]?I lost the original CD's that came with the card and nowhere in the current stuff is there a digital option I can find in the current driver. This is an older Audigy Platinum Ex. Specifically I need the software pictured in THIS picture (note the red circle):[img"]http://dmzweb3.europe.creative.com/wwimages/audio_int/audigy/spkr_settings4.gif">?But I cannot find it anywhere on the download section. If anybody knows where I can find it, or what to look for, I would greatly appreciate an assist.

    Forgot to mention I have all the latest audgiy 2 drivers and software

  • Combine two ints into a long without using chars or strings.

    Hi
    I have two ints and i need to combine (not add) them into a long value. The reason for this is because I need the make keys for a DB containing both values.
    eg.
    int1 = 3567453647
    int2= 6368535795
    long combination = combine(int1, int2);
    and the value of combination should be 35674536476368535795
    I know you can doing it by turning the ints into strings, combining the strings and then using the combined string as intput to a new Long(String) but I really need a faster way using pure maths (maybe bit shift?) as this combination function will be used billions of times.
    Thanks
    Edited by: user8908143 on 29-Sep-2010 19:52

    It's also a good way to get rid of boneheaded comments once one realizes how boneheaded they were. :-)A posteriori editing is another way :o)
    [OT: Forum features and moderators] A posteriori edition ( self- or mod- )
    Edited by: jduprez on Sep 30, 2010 6:21 PM
    That being said (and mocked), the binary shift left solution seems correct (although I'd definitely go for a custom class and double-column key instead).

  • Converting analog signals into digital signals

    I have been transferring analog video cassettes to iMovie for further editing by using a digital camcorder (Canon MV960) between the 8mm video camcorder (analog camcorder) and iMac. I have always done this without any cassette in the digital camcorder, i.e. I have been using the digital camcorder as an analog/digital converter only.
    I recently acquired iMovie HD 6 but this most recent version of iMovie refuses to import any signal from the analog camcorder via the digital camcorder. The window in iMovie is empty with an error message saying that "no tape". Well, it's true, there is no tape, there never was any tape when I used the previous version of iMovie!
    Does this mean that I have to convert the analog video tape into digital video tape and, once recorded in digital format, the digital tape can be imported in iMovie HD 6?
    All cable connections are OK:
    - the analog film could be seen in the screen of the digital camcorder:
    - digital video tape could be imported to iMovie HD 6.

    Hi 5480:
    try running a permissions repair (which should actually be done before and after upgrading software). You will find it in applications / utility / disk utility.
    Also, this is a copy of how Matti Haveri (iMovie Guru) sets up analoge to DV:
    My Analog to DV passthrough settings memo:
    1. Take the tape out of the camcorder
    2. Connect the analog device's audio and video to the camcorder's minijack, use the S-Video jack for video if the output device supports S-Video
    3. Put the camcorder into VTR-mode
    4. Select A/V->DV out: ON, in VTR mode's menu choices
    5. Disable the info display on the the camcorder by toggling its DISPLAY button
    6. Put iMovie (or other DV application) to the Camera Mode
    The analog image should now appear on the camcorder's screen as well as on the iMovie's screen.
    Note that if you have a tape in the camcorder, you have to put the camcorder's VTR into REC mode (you may pause the tape) but this is not advisable because it produces wear to the tape.
    * Note that the SCART which comes with the European nEUtered TRV320E camcorder is Out-only.
    Sue

  • How to cast an int into an Object?

    If I want to push the int called result (e.g. result = 3 + 4) on my Stack, it doesn't work, because push asks for an Object.
    So how can I cast my int into an Object?
    Thanks for help!
    trampoline

    All the primitive types have wrapper classes. In this case use the following:
    int result = 3+4;
    Integer iResult = new Integer(result);
    Now push iResult onto your stack.

  • How to format an int into something of this nature 12,000

    Does any one know how to format an int into a specifically formatted String?
    let say:
    int i = 12000
    I want:
    Sting s = $ 12,000
    Thanks for your help!!

    Yes, you use a DecimalFormat object. It's in the java.text package, and the API documentation has a lot of information about how to use it.

  • Problems on reading PCM into digital form

    Hi,
    I'm now on a project doing heart rate detection.
    Due to the project just started, therefore I do not got any device to measure my own heart rate, but I will be making up some PCM(analog) data, and try to read that into digital form and give me results of the heart rate.
    I'm not sure am I on the right track now or not,
    what I'm doing now is trying to convert a ".wav" into bytes array, then it should give me some data, however, I'm not sure how to relate that data into heart rate.
    Please leave me any comment if u think it might help please.
    Thanks,
    till

    I'm not too sure what should be the .wav should be, however, according to this acticle I got it from the web:
    _2.1 Signal acquisition_
    ECG signal frequency content lies between about 0.05Hz and
    500Hz and has amplitude of few mV. The acquisition is provided
    to be performed in three different ways: (i) using direct electrode
    measurements, (ii) using ECG equipment with analogous output;
    and (iii) using ECG equipment with digital output. For the first
    two cases, a sampling rate of 8 kHz is assumed. In the third case,
    the acquired discrete signals are accordingly resampled.
    _2.2 Modulation_
    The bandwidth of the phone’s voice channel is limited to the
    range 300Hz-3300Hz. The signal amplitude at the microphone
    input should not exceed 100mV. Modulation is performed through
    multiplication with carrying sinusoidal signals. Five 500Hz-wide
    channels are packed within the 500Hz-3000Hz band. The
    resulting signal is appropriately refined in amplitude and directed
    to the modulator’s output.
    _2.3 Digitizing, storing and sending_
    The complex signal is band-limited to 3300Hz. Therefore, a
    standard sampling frequency of 8 kHz is used for its digitization.
    A JAVA application performs that and in order to store the signal
    intact, the signal is recorded in a lossless format such as pulsecode
    modulation (PCM). The WAV audio file format implements
    PCM and is used to store the recorded modulated ECG signals.
    Once stored, the signals can be visualized, processed and sent by
    the mobile phone.
    Mobile phone’s firmware is accessible by programming
    languages as C++ and JavaTM. Most mobile phones support
    JavaTM runtime called Kilobyte Virtual Machine (KVM) [6]. This
    language provides the ability to build a GUI application that could
    support all the stages of recording, storing and transmitting of the
    ECG signal. JSR-135 contains libraries of JavaME, which are
    useful for capturing audio from the microphone's port of a mobile
    phone. The above mentioned platform was used to create the
    application software.
    _2.4 Demodulation_
    The procedure of demodulation is performed at the physician’s
    phone, following the reverse track of modulation. A digital band
    pass filter is used to separate the spectra, corresponding to the
    individual ECG signals. The filtered signal was then multiplied by
    the corresponding carrier frequency and filtered with a low pass
    filter, resulting in the original signal. The demodulated signals can
    be stored in separate WAV files in the physician’s phone.
    _2.5 Matlab simulations_
    In order to prove the principal feasibility of the approach, the
    signal acquisition, processing and transmission procedures were
    simulated in MATLAB. Five preliminary recorded ECG signals
    were directly loaded and used. The signals acquisition parameters
    were: 8-bit values, sampling rate of 250Hz and duration – 10S.
    Modulation and demodulation were programmed and performed
    in a numerical way. Modulation was done by multiplication of the
    ECG signals with carrying sinusoidal signals of frequencies
    500Hz, 1000Hz, 1500Hz, 2000Hz, and 2500Hz. The
    demodulation included first separating the spectrum of each
    individual signal with the help of 4-th order 400Hz-wide bandpass
    Butterword filters centered on the corresponding carrying
    frequency. Next the filtered signals were multiplied with the same
    carrier signals and eventually filtered with a low pass 4-th order
    Butterworth filter (fc=200Hz).
    btw, the system need to be implement into Symbian phone at the end,
    but I'm just now testing on the PC atm =)
    according to this article, what kind of wav I should be using ??
    thanks a lot!!!

  • Directly convert the analog signals into digital without passing through FPGA

    To whom it may concern,
    I am using a SCB-68 board R-series and I have a couple of technical questions:
    In my system at the moment 8 analog channels are connected to the 8 input analog ports and then data are sent to a FPGA (PXI system 7852R). I am planning now to add other 4 channels to the system. Since over the total 12 channels I just need a very fast acquisition mode (using the FPGA) for 6 of them, while the other 6 can be sampled in a ms scale, I was wondering if you can suggest me something that I can use to directly convert the analog signals into digital and in this way used many unused digital signals provided with this model.
    Thanks in advance.

    yes it is correct, what do you need is:
    software + (pc) + PXI + cable + chassis + C-series module
    With embedded controllers, there’s no need for an external PC
    With PXI remote control kits, you can control PXI systems directly from desktops, laptops, or server computers.
     What Is PXI?
    To configure a complete PXI System please go to: Build Your PXI System

  • Getting a Google Play book into digital editions.

    I can not find a way to add a google book into digital editions 2.  Can anyone help?

    Select the Menu Item File--> Add to Library and choose the file you want to add.
    or
    Copy the downloaded books to C:\Users\<USER NAME>\Documents\My Digital Editions folder, then it will loaded in the ADE Library.

Maybe you are looking for

  • Confirmation of production order - stock not updated

    Dear all On confirmation of production order,all dependent requirements as per bom (stock available at storage locations) should get updated ( as I set back flushing for all material stocks at material master level). But, when i do mb31, final produc

  • Imported Error -   The file cannot be imported. Unknown error occured (-50)

    I have the 30G Ipod. It has been freezing several times. I have reset and master reset several times. I used the updater program and restored the software (several times). I also reinstalled itunes & ipod software from the cd and updated to the lates

  • Message Stuck in Queues SMQ2

    Hi All.     We are having a production issue where now and then, we have message accumulation which is visible in SMQ2. Messages accumulates upto 10000 in the queues. Most of the times the queues are outbound queues XBTO* and the status of the messag

  • Combining a chart's image JPEG with a text label?

    Hi I am creating a JPEG file of a chart's plot. This works fine using the 'Write JPEG File'. As I have 8 charts in the VI to save to file, I have identified eact one using the label text. This appears OK when running but after saving the charts to fi

  • Tagging panelAccordion content for web analytics

    We have a panelAccordion component which contains a few showDetailItem components. At a time, only the data against the "*disclosed*" showDetailItem is available in the source(final html rendered). When a showDetail item is disclosed, the new content