~~~ Need some help doing some operations with 1-D Arrays ~~~

I'm studying for my final in cs and I'm completely lost on one of the topics in the review sheet, it asks me to know how to find the smallest/largest values in a given 1-D array
lets just say I have an array called aRay and it's values are 1, 9, 3 ,4 and 11, in that order
int[] aRay = new int[5];
int[0] aRay = 1;
int[1] aRay = 9;
int[2] aRay = 3;
int[3] aRay = 4;
int[4] aRay = 11;
I don't know if I did that right but ok, I know I need to use a for loop, and use temp values to store a value and check if the next one is smaller, and if so, grab that one and keep going?
int temp = 1;
for ( int i = 0; int[i] < int[temp]; i++)
temp++;
Am I even on the right track.. :(
thanks for your comments and help everyone, much appreciated

public class bladddh
     public static void main( String [] args )
          int[] aRay = new int[5];
          aRay[0] = 1;
          aRay[1] = 9;
          aRay[2] = 3;
          aRay[3] = 4;
        aRay[4] = 11;
          //for finding the smallest
          int num=0; //will be the largest value by the end.
          for(int i=0;i<aRay.length;i++)
             if(aRay>num)
          num=aRay[i];
          if(i == 4)
               for(int j=0; j<aRay.length; j++)
                         if(aRay[j]<num)
                              num=aRay[j];
          System.out.println(num);
}I got it :D you said it wouldn't work for negative numbers though? is there a better way?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • Hello plz i need yours help i have problem with my i cloud back up when i restore old back up t

    hello >> plz i need yours help i have problem with my i cloud back up when i restore old back up my problem exact with contact cause it disappears from contact list

    iPhone: Transferring information from your current iPhone to a new iPhone

  • "Hi,I need a help something wrong happen with my ITunes ,during to the download progress,after few seconds is report ; U can not download,err" in Using iPad • 0 bookmarks

    "Hi,I need a help something wrong happen with my ITunes ,during to the download progress,after few seconds is report ; U can not download,err"
    in Using iPad •

    It's better to post the URL of the feed (as you have subsequently done) than the contents of the feed .
    From the FeedValidator report the feed is basically OK for iTunes. There are several occasions where 'content:encoded' sections (following immediately on 'guid' tags) should be enclosed in
    <description>...</description>
    tags: however all this will be ignored by iTunes anyway and only applies to other readers. The 'potentially dangerous content' referred to by FeedValidator is within the 'content:encoded' tags and so isn't relevant to iTunes. They are referring to an inline css style, and I don't know whether this might cause a problem elsewhere.
    You should really have a language tag, e.g.
    <language>en-us</language>
    (you have a dc:language tag but that's for a different system). This should be placed in the top section, before the first 'item' tag.
    It's advisable to have an 'itunes:explicit' tag for each 'item' -
    <itunes:explicit>yes IF CONTAINS ADULT MATERIAL, OTHERWISE no</itunes:explicit>
    it's not compulsory if you have no adult material, but you must have a 'yes' if you do.
    You can check your feed by subscribing in iTunes from the 'Advanced' menu - this has the same result as clicking the 'Subscribe' button on the Store page. If it works OK there you are ready to submit it.

  • Need a help on implemening SAML with Oracle Service Bus

    We are implementing Webservice security using SAML with Oracle Service Bus for our project. We are in dire need of help in implementing the same. We have found some documents (osb console help, osb security) from the oracle web site but those documents have high-level details only. If we get the step-by-step flow and examples of implementing the Webservices security using SAML with Oracle Service Bus, it would be appreciated.
    Requirement details:
    1. Client application has to generate the SAML assertion (token) and pass that token to the OSB proxy service in a SOAP header along with the request.
    2. OSB proxy service gets the authentication token from the inbound request
    3. The token is passed to an SAML Identity Assertion provider and validate the token
    4. If the token is validated successfully then pass the valid token to appropriate business services.
    5. Business services communicates the appropriate external web services after validating the token and gets the response.
    Environment details:
    1. Oracle Weblogic Application Server 10g3
    2. Oracle Service Bus 10g3
    Thanks,
    Suresh Mani

    We are implementing Webservice security using SAML with Oracle Service Bus for our project. We are in dire need of help in implementing the same. We have found some documents (osb console help, osb security) from the oracle web site but those documents have high-level details only. If we get the step-by-step flow and examples of implementing the Webservices security using SAML with Oracle Service Bus, it would be appreciated.
    Requirement details:
    1. Client application has to generate the SAML assertion (token) and pass that token to the OSB proxy service in a SOAP header along with the request.
    2. OSB proxy service gets the authentication token from the inbound request
    3. The token is passed to an SAML Identity Assertion provider and validate the token
    4. If the token is validated successfully then pass the valid token to appropriate business services.
    5. Business services communicates the appropriate external web services after validating the token and gets the response.
    Environment details:
    1. Oracle Weblogic Application Server 10g3
    2. Oracle Service Bus 10g3
    Thanks,
    Suresh Mani

  • Need Urgent Help. ORA-12500 with no reason

    I need urgent help.
    I have 8.1.7.2.1 on Win2K.
    I get ORA-12500 error when trying to connect oracle instance. This problem begin to arise only when number of sessions reach a number about 200. At the same time there is no definite boundary for it. Once it happened when there were 216 session, then 196, then 206.
    There rarely (1/100) I get ORA-12514 and after again ORA-12500. Once I got ORA-12600.
    What it might be you think? It can't be a problem in listener.ora or in tnsnames.ora because it works fine if number of sessions is about 100. It tried to restart tnslistener (from lsnrctl and the service) and restarted database (but not the service). I did it different in sequences, but didn't help. What should I do? Is it a known bug?

    I need urgent help.
    I have 8.1.7.2.1 on Win2K.
    I get ORA-12500 error when trying to connect oracle instance. This problem begin to arise only when number of sessions reach a number about 200. At the same time there is no definite boundary for it. Once it happened when there were 216 session, then 196, then 206.
    There rarely (1/100) I get ORA-12514 and after again ORA-12500. Once I got ORA-12600.
    What it might be you think? It can't be a problem in listener.ora or in tnsnames.ora because it works fine if number of sessions is about 100. It tried to restart tnslistener (from lsnrctl and the service) and restarted database (but not the service). I did it different in sequences, but didn't help. What should I do? Is it a known bug? bash-2.03$ oerr ora 12500
    12500, 00000, "TNS:listener failed to start a dedicated server process"
    // *Cause:  The process of starting up a dedicated server process failed.
    // The executable could not be found or the environment may be set up
    // incorrectly.
    // *Action: Turn on tracing at the ADMIN level and reexecute the operation.
    // Verify that the ORACLE Server executable is present and has execute
    // permissions enabled. Ensure that the ORACLE environment is specified
    // correctly in LISTENER.ORA. The Oracle Protocol Adapter that is being
    // called may not be installed on the local hard drive. Please check that
    // the correct Protocol Adapter are successfully linked.
    // If error persists, contact Oracle Customer Support.
    There is not enough info to go on but the problem seems to be either in the listener.ora
    or tnsnames.ora. Did you make any changes before this started occurring?
    William

  • I need your help regarding Macbook Pro with FCS3 via USB

    Sorry for the double posting, I need your help...
    I am producing an independent TV movie. We are shooting in HDV with a Sony Z5.
    Currently I am using a 2007 iMac (1gb) for the FCS3. I am considering buying a Macbook Pro 15' i7, because I need the portability as well as a WD 1TB portable external drive.
    Just when I am about to buy the machine I started to read all about the USB vs. the Firewire. What should I do? The MBP only have one firewire port...if I use an USB portable external drive means that I won't be able to use FCS3 properly and that buying a MBP will mean spending money in something that I won't be able to make it work properly??
    Thanks for your help!!!!

    Hi there,
    As Patrick said its Firewire hubs you should avoid along with directly connecting your media drive via USB. USB hubs are fine for connecting peripherals (keyboards, tablets, mice etc). directly connecting USB media drives is not for streaming video due to their method of sending data in packets rather than as the continuous stream that firewire provides. Firewire hubs just seem to cause all sorts of headaches to those that have used them, I cant give you a specific reason other than splitting the available FW bandwidth (someone with more knowledge on this will have to chime in), its more just inherited practice.
    cheers
    ANdy

  • Need some help if you can with my S3

    I have been trying to change the sound of when a text comes in and I can't seem to figure out how to change the sound.  I keep changing the notification sound but that doesn't do it.  I hit text messages and then the menu and there is nothing there to change it.  What am I doing wrong?  I test with my husband allot during the day but If I can't hear the text I can't respond to him.  Thank you all soo much for your help!

    Actually, you can modify ringtone for each contact by opening up Contacts, persons name, and it has Ringtones. Under Ringtones, it has Default... you can change that to whichever... although I am not sure whether that is a text ringtone or a call ringtone...my bet is on the call ringtone...

  • I need some help formatting some text

    I'm trying to convert a theater script to EPUB. The original file I received was a pdf. I already placed all the text in my InDesign document, but among all the text, there are some phrases between parenthesis that need to be in italics.
    Is there a way that I could instruct InDesign to change all characters between parenthesis to italics? Or will I need to manually identify and change them?
    Thanks for you help!

    Wow, never heard about this. Thank you so much.
    I'll try it when I get back home from work and post back with results.
    Now for instance, say I would like to select something between other symbols beside parenthesis, which characters should I change in the string? Tho ones in the outside or the inside? For example, if I want to select something between quotes, would the string be "?<=\().*?(?=\)" or (?<=\().*?"?=\")?
    Or am I just making stuff up and it not possible?
    Again, thanks for all the help.

  • Need some help playing some frames...

    I have a code that lets a character run across the stage. Once that character hits another character I want the character to play a specific frame and then go back to the begining spot which is frame 1. I can get the character to run across the stage and do a collision detection but can't get it to play the frame. Any help will be appreciated. Thanks.
    I'm using the below to try to get what I want. I'm getting all my traces, but not the movie clip.
    [AS]
            function onEnterFrame(event:Event):void
                if (player.hitTestObject(enemy2))
                    trace("collision detection");
                    var player_attack_mc2_cd_boolean:Boolean = true;
                   //Attack mc2
                    if (player_attack_mc2_cd_boolean == true)
                        player.gotoAndStop("player_attack_mc2");
                        trace("attack");
                        var player_attack_mc2_boolean:Boolean = true;
                    if (player_attack_mc2_boolean == true)
                        player.gotoAndStop(1);
                        trace("goto frame 1");
    [/AS]

    Same thing with your next variable... totoally not needed. So your code:
      function onEnterFrame(event:Event):void
                if (player.hitTestObject(enemy2))
                    trace("collision detection");
                    var player_attack_mc2_cd_boolean:Boolean = true;
                   //Attack mc2
                    if (player_attack_mc2_cd_boolean == true)
                        player.gotoAndStop("player_attack_mc2");
                        trace("attack");
                        var player_attack_mc2_boolean:Boolean = true;
                    if (player_attack_mc2_boolean == true)
                        player.gotoAndStop(1);
                        trace("goto frame 1");
    Becomes:
      function onEnterFrame(event:Event):void
                if (player.hitTestObject(enemy2))
                    trace("collision detection");
                      player.gotoAndStop("player_attack_mc2");
                      trace("attack");
                        player.gotoAndStop(1);
                        trace("goto frame 1");
    Which of course isn't really going to work because you have player going to two places at the same time. You need to rethink your design here.

  • New to Solaris 9 - Needs some help, if some could answer my question plz !!

    Hello!
    During the installation when I set that the computer is not networked, everything (SMC) seems to work absolutely fine.
    But when I set the option that the computer is networked, The SMC (Solaris management Console) doesn;t startup. it says again and again that the server couldn't be found. Although I tried to stop and again start the SMC server process, but it didn;t work.,
    Please help me out !!!!

    I'll give this a shot:
    Does other network traffic work? Assuming that you are new to Solaris 9, and not just UNIX in general, you may want to make sure that your network settings are correct (ip addy, netmask, default route, and so on) SMC usually starts up a network service on port 898 (IIRC), and then starts up the client (the actual GUI) and connects to itself.

  • New to Solaris 9 - Need some help, if some one could answer my question plz

    Hello!
    During the installation when I set that the computer is not networked, everything (SMC) seems to work absolutely fine.
    But when I set the option that the computer is networked, The SMC (Solaris management Console) doesn;t startup. it says again and again that the server couldn't be found. Although I tried to stop and again start the SMC server process, but it didn;t work.,
    Please help me out !!!!

    I had the same problem and I installed the system not networked and then configured the network.

  • I need some help plz  some one replay me

    i wont to write a query to have result like this table from emp table
    length_for length_fif length_sex
    KING BLAKE MARTIN
    WARD CLARK TURNER
    FORD JONES MILLER
    ALLEN
    JAMES
    SMITH
    SCOTT
    ADAMS
    this is what i can do
    but it's not work
    select decode(length(ename),4,ename) for_lnth,
    decode(length(ename),5,ename) fif_lnth,
    decode(length(ename),6,ename) sex_lnth
    from emp;
    FOR_LNTH FIF_LNTH SEX_LNTH
    KING
    BLAKE
    CLARK
    JONES
    MARTIN
    ALLEN
    TURNER
    JAMES
    WARD
    FORD
    SMITH
    SCOTT
    ADAMS
    MILLER
    there's many field Null and i don't wont to write the number of letter like 4,5,6 in the query
    i wont the query find out how many letter are there in the name
    and aaaaaaaaaaaaa
    i'm waiting.....

    Hi,
    Welcome to the forum!
    This site replaces multiple whitespace with a single space by default, so things that are nicely formatted when you post them look terrible after you post them.
    Type these 6 characters
    &#123;code&#125;
    (small letters only, inside curly brackets) before and after formatted text, to preserve spacing.
    Re-arranging your one-column output into three columns is called pivoting.
    Here's one way to do it:
    WITH     got_rnum
    AS
         SELECT     ename
         ,     LENGTH (ename)     AS len
         ,     ROW_NUMBER () OVER ( PARTITION BY  LENGTH (ename)
                                   ORDER BY          ename     -- optional
                           )  AS rnum
         FROM     scott.emp
    SELECT       MAX (CASE WHEN len = 4 THEN ename END)     AS length_4
    ,       MAX (CASE WHEN len = 5 THEN ename END)     AS length_5
    ,       MAX (CASE WHEN len = 6 THEN ename END)     AS length_6
    FROM       got_rnum
    GROUP BY  rnum
    ORDER BY  rnum;The only place where I had to know what the lengths were was when I wrote three lines for the SELECT clause (for lengths 4, 5, and 6).
    If you the query to do this, then you have to use dynamic SQL, to figure out how many different lengts there are, and what they are, and to write an appropriate SELECT clause for you.
    As dynamic SQL gioes, this is pretty easy. You can do it in SQL*Plus or PL/SQL.

  • Need fast help... problem with .eps files

    So I'm in a bind helping my company put out T-Shirts...
    We need things in .eps format. I'm the one who has some design experience so I've been doing it. What we need though is the design to be saved on a transparent background so when it's imported into our T shirt program, it doesn't maintain the square from the artboard.
    Not sure what I'm doing wrong.. any guidance?

    Eps files generally have no background.
    Are you certain here isn't just a white square or something in the file?
    Or.. is there a drop shadow or outer glow applied? These effects will cause a background because of the transparency. Because an EPS is a flat file format, the best you can do is put a box matching the background color you want behind the shadow/glow, then save as EPS. Or remove the effect.

  • Need urgent help -update customer account with out stock(Reserve Invoice)

    hi
    when we creating an invoice ,it will update both customer account and
    invetory account. i need only customer account. how can do with this function using oInvoice buisness object and oinvoices lines. i am using
    C#
    Thanks
    Edited by: sap_beginer on May 1, 2008 2:55 PM

    Its same as I wrote you in other thread, use service type of invoice as
    .DocType = SAPbobsCOM.BoDocumentTypes.dDocument_Service
    Petr

  • Need Immediate Help - doing presentation NOW - projector not mirroring!!

    HELP!!!!
    We are in Ireland, from Canada, teaching for four days, and the projector is not detecting the MacBook (not the Pro, that is at home) at all - we have tried to detect displays repeatedly, and nothing happens. The light is on the Mitsubishi projector, it says NO SOURCE, everything is connected properly, and we are totally freaked thus far...
    Any help VERY welcome!
    Thanks,
    Patty

    Sorry for the delay in etting back to you, hopefuly you have it sorted by now. If not try these;
    1. On your list you have RGB input, select this then try and change this to video,(on mine I have a choice of RGB & Video), give it a few seconds to which it will obviously find nothing then switch it back to RGB which it will search again and fingers crossed will find the output signal of your MacBook.
    2. Check the output resolution of the projector then change your MacBook's resolution to that of the projector (I dont think this will make much of a difference but its worth a shot!)
    3. If still no joy I would try and find an alternative display just to check your output from the MacBook is working ok, a normal computor monitor will do the job other wise anything with a VGA input. This will at least let you know if its the MacBook or the projector that has the problem.
    Hope you manage to get it sorted. When you do please post back as it would be good to know what happend.

Maybe you are looking for

  • Reader X displays scanned images as blank, grey pages

    I have a great many PDFs (version 1.5) that are now unreadable with Acrobat X. These pages consist of scanned images that were converted to PDF, but now the pages are grey. You can search the OCR of the documents as before, but you can't see the page

  • Problem with infinitive loop for a socket listening

    I want my server program to respond different clients by means of listening the socket via a thread. If I write the thread as a different class j2sdk1.4.0 gives a compile error, but as a method in the class it works well. Will you please show me the

  • Duplicate records in generic data source

    Hello, We have created a generic data source using a database view joing two tables MARA and MBEW. When we run the view in our DEV server, we get perfectly fine data. Now when run the same view in QA, we get duplicate records. Is it any thing to do w

  • MultiMapping Function Java Maping--Splitandmerger

    Hi Frnds, I am trying to develop multi mapping functionality using JAVA Mapping, I wrote the code But its not working .. I need to add the xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge to my output manually in DOM parcer code?? if i add that one its

  • Authorization/deauthorization

    My friend came over and we both authorized each others computers on iTunes so we could share apps. I no longer want my friend to be able to use my iTunes purchases. How do I stop him from using my purchases on his computer?