Help get the array number fo a element

Hi
1. This program does the following: Ask for three numbers, print them in a row and show the largest number of the three.
2. I also would like the program to: Print out the position of the array, whre the largest number is. Please give me a hint where to begin.
import java.util.*;
public class Ovning5 {
     public static void main (String [] arg) {
          Scanner scan = new Scanner (System.in);
          int [] numbers = new int [3]; // New array
          int x; // Numbers in array
          int largestNumber; // Largest number in the array
          // Ask for numbers
          System.out.print("Put in (three) numbers");
          for (x=0; x<numbers.length; x++) {
               numbers[x]=scan.nextInt ();
          // Print numbers in a row     
          for (x=0; x<numbers.length; x++) {
               System.out.print (numbers[x]+ " ");
          // Put a new line before next function
          System.out.println (); {     
               // Find the largest number     
               largestNumber = 0; // Set the highest number to 0
               for (x=0; x<numbers.length; x++) { // Use the first number in the array.
                    if (x == 0) {
                         largestNumber = numbers[0];
                    // if the current number we're
                    // looking at in the array is bigger than the highest number,
                    // set the highest number to this current number
                    if (numbers[x] > largestNumber) {
                         largestNumber = numbers[x];
               }     // Close new line function
            // Print out the largest number
               System.out.println("The biggest number is " + largestNumber);
}

"As you iterate over the array, looking for the largest element, keep track of the index of the largest element as well as it's value. Whenever you set the largest to array[n], also store n."
It took a while to figure out, but it is something like this you meen :)
// Find the largest number and the position in the array     
               largestNumber = 0; // Set the highest number to 0
               for (x=0; x<numbers.length; x++) { // Use the first number in the array.
                    if (x == 0) {
                         largestNumber = numbers[0];
                    // if the current number we're
                    // looking at in the array is bigger than the highest number,
                    // set the highest number to this current number
                    if (numbers[x] > largestNumber) {
                         largestNumber = numbers[x];
                         y=x; // Since we look at all the numbers in the loop
                         // and we started from zero, y is going to be compared to xDo you think my comments make sense?

Similar Messages

  • I need help getting the license number for Adobe Photoshop Elements. However, It doesn't recognize me as an authorized user. Can someone help?

    I need help getting the license number for Adobe Photoshop Elements. However, It doesn't recognize me as an authorized user. Can someone help?@

    I am having the same problem...did you ever fix it?

  • HT201365 i lost my ipod5 and cant remember the serial number i need help getting the serial number on my ipod 5

    i lost my ipod 5 and i cant remember my serial number i need help with my serial number

    Finding serial number for a device - https://discussions.apple.com/message/18246553 - from box or backup file, not from Apple.
    http://support.apple.com/kb/HT2526 - If you registered a device you can use My Support Profile to find a list of serial numbers that have been purchased or registered with your Apple ID.
    My Support Profile - https://supportprofile.apple.com/MySupportProfile.do
    Maybe a way to find serial number after a device is no longer in your possession - https://discussions.apple.com/message/19524469 - "The easiest way to find your serial number is this Open Itunes...click help... run diagnostics.....(tick or untick as necessary) so that you just have ticked the last two, device connectivity and device sync. run these tests. it will say no ipod/ipad found but will give results of test....scroll down to bottom of results... here you will find the serial number of your last attached devices."
    iPhone: Locating the serial number, IMEI, ICCID, or MEID - http://support.apple.com/kb/HT1267 - from phone itself, a computer to which it has been backed up, or packaging.

  • I need help to find the serial number for Photoshop Elements 11

    Hi! I need help to find the serial number for Photoshop Elements 11 I downloaded last year on Apple Application Store.. I have been using photoshop on mac for over a year and now need the serial number to be able to use it on macbook. I looked up Adobe's website for help but found none and noone to ask for support.. Any ideas how I can get the serial number using the App Sore bill I have?

    Please post Photoshop Elements related queries over at
    http://forums.adobe.com/community/photoshop_elements

  • I have my redemption code but can't get the serial number for adobe photoshop elements 12 that I jus

    I'm trying to find out my serial number.  I have the redemption code but can't get the serial number for adobe photoshop elements 12 that I just purchased

    Hi KEsheppard
    Please refer the link below to get the help regarding redemption code and the serial number:
    http://helpx.adobe.com/x-productkb/global/redemption-code-help.html
    Let us know if it helps,
    Thanks!
    Gurleen Kaur

  • I purchased Photoshop Element online 1/19/2015 and have AD015439775 number but not the serial number.  How do I get the serial number, please?

    I purchased Photoshop Element online 1/19/2015 and have AD015439775 number but not the serial number.  How do I get the serial number, please?

    Redemption Code Help
    Mylenium

  • Need Functional help to get the MIRO  Number from deferent seanario.

    Hai All
    I developed One report to get the Accounting document number by using PO number.
    CASE 1. In My Case One single PO is having Multiple GRN each GRN amy Have Single MIRO number or Multiple MIRO Number.
    I ll get this By Using PO with Line Item Number this is not an Issue.
    CASE2.  In One PO Multiple GRN is there and One Single ITEM is having Two GRN Number, Each GRN is having single Accounting Number (MIRO) number.
    Tell me how can i do this
    actually I am using RSEG and BKPF table to get accounting Number.
    Which table i have to use to get the Accounting number by using GRN number.
    Please Help me.
    Jagadish.

    iText. PdfReader.getNumberOfPages()

  • I downloaded elements 11 and don't know where ton get the serial number?

    I downloaded elements 11 online but I don't know where to get the serial number?

    Please refer : http://helpx.adobe.com/x-productkb/global/find-serial-number.html

  • HT4061 My Child has disabled my ipad mini...It ran out of charge and now is disabled for 22928370 minutes, what can I do as I cant get onto the ipad to get the serial number to speak to an advisor and its only 10 months old. HELP!

    Please help me....
    My Child has disabled my ipad mini...It ran out of charge and now is disabled for 22928370 minutes, what can I do as I cant get onto the ipad to get the serial number to speak to an advisor and its only 10 months old. HELP!

    Hello Jesslocko,
    Before following the iPad Restore process make sure you have updated version of iTunes installed on your computer, to check that Open iTunes on your computer click on Help and then check for updates ( If there is any updates available then Install it ) and If you do not have iTunes Installed or if you want to directly update the version of your iTunes then Download and Install iTunes from here : http://www.apple.com/itunes/download/
    1. Make sure your device (iPad) is unplugged (Disconnected) from your computer (this should be the computer that you use to sync your iPad or you can use any other computer with iTunes installed in it). You can leave the USB cable connected to your iPad though.
    2. Turn off your iPad. Press and hold the power button on the top edge until a slider appears. Slide it from left to right to power off your device. If the slider doesn't appear (because your iOS device has frozen up) then hold the power and Home buttons down until the iPhone or iPad turns off.
    3. Ensure your device has a decent amount of charge. Leave it plugged in to the mains for 10 minutes or so if you see the flat battery icon. (iPad low battery)
    4. Hold down the Home button (the round button at the bottom of your iPad screen) and connect the other end of USB cable to the computer this should cause your iPhone or iPad to turn on. Keep holding the Home button until you see the iTunes and USB cable images on your iPad screen, then release the button.(iPad recovery mode)
    5. In iTunes (launch the application if it isn't running on your Computer), you should see a message saying an iPad has been found in recovery mode.
    6. Click OK and then click on Restore to bring your iPad to Factory settings

  • Where do I get the serial number from for Photoshop Elements

    Where do I get the serial number from for Photoshop Elements?  I need to use on a new computer as my old computer crashed.  Orignally the program was loaded with a download application online.

    If you registered PSE, go to the main page of adobe.com and look for My Adobe, then work through the links there and you will find a list of your adobe products and their serial numbers.

  • HT204204 I need help talking to a person. My phone is not working so I can't call and i can't get the serial number to get ahold of anyone. what do i do

    How do i get ahold of a real person? My phone is only showing a black screen so I can't get on it to get the serial number or call anyone. please help

    http://www.apple.com/support/iphone/contact/

  • How can I get the serial number for Premiere 11?

    In october 2012 I´ve bought a bundle pack with Photoshop Elements 11 and Premiere 11. After a hard disk crash i was about to reinstall them both but my wife has trown the envelope in the garbage... = No Serial number available!!
    I´ve registered the serial number for Photoshop Element 11 on Adobe, but not the key for Premiere (they are on the same dvd).
    How can I get the serial number for Premiere 11?

    I do not think there is any way for anyone here to help you (we are just other users) so you are going to have to contact Adobe
    Forum for Download & Install & Setup problems
    http://forums.adobe.com/community/download_install_setup
    Chat http://www.adobe.com/support/download-install/supportinfo/
    -or http://www.adobe.com/support/chat/ivrchat.html
    And tell your wife to be more careful about throwing things away

  • Where is the serial number on Photoshop Elements 12?

    It's not on the DVD packet or on the box.

    When I bought Elements 11 at Best Buy in the US, there was a redemption-code on the box that I had to type into a website, that was also specified on the box, to get the serial number:
    http://helpx.adobe.com/x-productkb/global/redemption-code-help.html#productboxorprepaidcar d

  • Hwo to get the spool number from report output

    Hi,
    I am displaying some output in the report using write statements and within my program I need to collect the output written by write statements and send it as an email.So for that I need to generate the spool number and I am using the below code to do that
    CONSTANTS:
        l_linsz TYPE sy-linsz VALUE 201, " Line size
        l_paart TYPE sy-paart VALUE 'X_65_132'.  " Paper Format
      l_uname = sy-uname .
      l_repid = sy-repid .
    *-- Setup the Print Parmaters
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING
          authority              = space
          copies                 = '1'
          cover_page             = space
          data_set               = space
          department             = space
          destination            = space
          expiration             = '1'
          immediately            = space
          new_list_id            = k_x
          no_dialog              = k_x
          user                   = l_uname
        IMPORTING
          out_parameters         = l_mstr_print_parms
          valid                  = l_mc_valid
        EXCEPTIONS
          archive_info_not_found = 1
          invalid_print_params   = 2
          invalid_archive_params = 3
          OTHERS                 = 4.
    *-- Make sure that a printer destination has been set up
    *-- If this is not done the PDF function module ABENDS
      IF l_mstr_print_parms-pdest = space.
        l_mstr_print_parms-pdest = k_lp01.
      ENDIF.
    *-- Explicitly set line width, and output format so that
    *-- the PDF conversion comes out OK
      l_mstr_print_parms-linsz = l_linsz.
      l_mstr_print_parms-paart = l_paart.
      l_variante = sy-slset.
    * submitting the spool request
      *SUBMIT (l_repid) TO SAP-SPOOL*
                       *SPOOL PARAMETERS l_mstr_print_parms*
                       *WITHOUT SPOOL DYNPRO*
                       *AND RETURN.*
    *Calculating the lenth of report name
      lv_len = STRLEN( l_repid ) .
    *consutrucing the database variable  rq2name to search the spool
    *request
      IF lv_len >= 9 .
        CONCATENATE l_repid+0(9)
                    l_uname+0(3) INTO lc_rq2name .
      ELSE.
        lv_len = 9 - lv_len .
        DO lv_len TIMES .
          CONCATENATE lv_temp '_' INTO lv_temp .
        ENDDO.
        CONCATENATE l_repid lv_temp
                    l_uname INTO lc_rq2name .
      ENDIF.
    *selecting the spool request using the above consructed varibale
      SELECT   * FROM tsp01 INTO TABLE lt_tsp01
              WHERE rq2name = lc_rq2name .
    *sorting the interbla table
      SORT  lt_tsp01 BY rqcretime DESCENDING .
    *reading the first spool request
      READ TABLE lt_tsp01 INTO ls_tsp01 INDEX 1.
    but the problem with the above code is I am using variants to execute the report but when the above piece of code is getting executed it is clearing all the variant values on the selection screen and it is defaulting the values on the selection screen.
    Is there any way i can execute the above code without any problem in the selection screen.
    Thanks
    Bala Duvvuri

    Hello Bala,
    I wouldn't SUBMIT the same program to get the Spool number. You can achieve the same by [NEW-PAGE PRINT ON|http://help.sap.com/abapdocu_702/en/abapnew-page_print.htm#!ABAP_ADDITION_1@1@] command.
    Check the code snippet i've provided below:
    DATA: spfli_wa         TYPE spfli,
          print_parameters TYPE pri_params,
          valid_flag       TYPE c LENGTH 1.
    START-OF-SELECTION.
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING
          no_dialog            = 'X'
        IMPORTING
          out_parameters       = print_parameters
          valid                = valid_flag
        EXCEPTIONS
          invalid_print_params = 2
          OTHERS               = 4.
      IF valid_flag = 'X' AND sy-subrc = 0.
    *   1. Write the output to the output list(no spool is generated)
        SELECT carrid connid
               FROM spfli
               INTO CORRESPONDING FIELDS OF spfli_wa.
          WRITE: / spfli_wa-carrid, spfli_wa-connid.
        ENDSELECT.
    *   2. Write the output to SAP spool(no list is displayed)
        NEW-PAGE PRINT ON PARAMETERS print_parameters NO DIALOG.
        SELECT carrid connid
               FROM spfli
               INTO CORRESPONDING FIELDS OF spfli_wa.
          WRITE: / spfli_wa-carrid, spfli_wa-connid.
        ENDSELECT.
        NEW-PAGE PRINT OFF.
        MESSAGE i000(zibi027) WITH 'Spool' sy-spono 'is generated!!!'.
        "You can use the spool number (SY-SPONO) to email the list output
      ENDIF.
    Hope this helps.
    BR,
    Suhas

  • How to get the focus of particular UI Element

    Hi All,
    How to get the focus of particular UI Element in webdynpro Page,
    I have a page where i am creating a ALV, I want to get that keyboard focus is on that element is there or not?
    Can anyone please give some update?
    Best regards,
    Rohit

    I would suggest try invoking REFRESH of ALV on the ON_CELL_ACTION event.
    Below excerpt is from Thomas
    The Events of inner UI elements are not exposed directly as they normally would be if they were standalone. Generally you can capture them using either the
    ON_DATA_CHECK:
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/c8/6c80dbedfe42d1a93f8e6df1d7244a/frameset.htm
    This gets trigger for any press of ENTER, so it generally works like the Input Field onEnter.
    You could also consider ON_CELL_ACTION:
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/45/12093591152464e10000000a1553f7/frameset.htm
    It is a higher level Event that encompasses both ON_DATA_CHECK and ON_CLICK.
    if you want to capture & refresh on some hot key combination then refer to this thread
    [https://www.sdn.sap.com/irj/scn/profile?editmode=true&userid=3760417]

Maybe you are looking for

  • Popup message while creating new CRM activities in the Portal

    Hello All,     We are implementing EP 7.0 SPS 12 and have integrated CRM 5.0 with it. We have installed CRM BP 5.0 SPS 01. When we are creating activities through the Portal using the "Business Activity" iview and then save the creation, we get a pop

  • When/why do we create custom method in Entity DefImpl ?

    Hi All, I am reading "ADF Dev Guide 4 GL" on "section 9.6.2 : Implementing an Efficient Existence Check " , referring to the SRDemo sample. I do not understand why the "exists" method is created in ProductDefImpl ? Why don't we create it in ProductIm

  • Conversion from 5.1 to 2009 and 2013

    Hello, please, can you convert my VIs from LV 5.1 to LV 2009 and 2013? Thank you very much! Attachments: gamp.zip ‏203 KB

  • I cannot access the sharefolder in W2008R2 in sub-domain.

    We cannot access the network shareholder in W2008R2 DC of the sub-domain. Our scenario is as follows: The main-domain(AAA.com) has two DCs (W2008R2+W2003R2). The sub-domain(BBB.AAA.com) has two DCs(W2008R2+W2003R2). There is trust relation between AA

  • Assigning applications to spaces under Mavericks

    In mountain lion you could assign an application to a particular space or all spaces. This option no longer seems to be available in Mavericks. The problem is that mavericks remembers the old settings. Is there a way to change the old settings?