Trying to find out how to get the smallest value in a 2-D array

I figured out how to get the largest and smallest in a 1-D array, but I'm having trouble with the for loop for the 2-D array
I can't seem to figure out how I can get it to check every element in the 2-D array
Lets say I have this array
int[][] aRay = new int[][] {{ 1, 2, 3} , {4, 5, 6 }};and I want to find the smallest value, I think I can figure out what goes in the box of the for loop I just need help with how I can check every element..
Thanks all

Ok so here's what i've got so far and my brain is starting to hurt,
My output right now is "2".. i'm almost there :/ aren't I?
public class bladddhd
     public static void main( String [] args )
     int[][] aRay = new int[][] {{ 1, 2, 3} , {4, 5, 6 }};
          int length2 = aRay[0].length;
          int temp = 0;
          for(int i = 0; i < aRay.length; ++ i)
                    if(aRay[0] > temp)
                         temp = aRay[0][i];
                    for(int j = 0; j < length2; ++j)
                              if(aRay[1][j] < temp)
                                   temp = aRay[1][j];
               System.out.println(temp);

Similar Messages

  • HT204409 Can someone please help me.....I am trying to find out how you get the pass word for joining a Wi-Fi when asked to join and then told to put in a password. How do you get that?

    ok

    Thank you roaminggnome. All that I don't know. I know nothing about all this stuff. I am on a pc here at home that has a cable hookup to Roadrunner internet. Some kind of modome with a buch of lights sit on top of my computer that hooks me up. So I don't guess I have wi-fi here. Ever since I got my iphone 4, I have been trying to use FaceTime here and it always tell me that I need a wi-fi connection I think. Also wanted to update to iso5 again it tells me the same. Every now and then a thing will pop up on my phone asking if I want to join a certain Wi-Fi that has the littlck on it and when I click join it tells me to put in the pass word to join. NO GO! Thanks again for your help. I do appreciate it. I guess I will have to find someone that lives around me that can explain this stuff to me and show me what is needed.

  • I am trying to find out how to copy the image on my existing hard drive to my new hard drive before I install it so it will be like I didn't do anything.

    I am trying to find out how to copy the image on my existing hard drive to my new hard drive before I install it so it will be like I didn't do anything. Thanks for the info. on changing it.

    Format is found in the Erase Tab:
    The Disk Image is found on the Restore Tab:

  • HT2931 I am trying to figure out how to get the pre made "beats" with my garage band for my MacBook Air can u help

    I am trying to figure out how to get the pre made "beats" with my garage band for my MacBook Air can u help

    Hello Mattxy2,
    Thank you for the question. It sounds like you would like to add some Apple Loops to your project.  I recommend reviewing the following sections in Garageband Help:
    GarageBand Help - Search for Apple Loops
    http://help.apple.com/garageband/mac/10.0/#gbnd3002ab64
    GarageBand Help - Add Apple Loops to your projects
    http://help.apple.com/garageband/mac/10.0/#gbndc1d3db81
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • I have recently had to fire my web designer who was using iWeb.  Now I'm trying to figure out how to get the site to open in iWeb on my new MacBook Pro.  Is there a way?

    I have recently had to fire my web designer who was using iWeb.  Now I'm trying to figure out how to get the site to open in iWeb on my new MacBook Pro.  Is there a way?

    Firstly iWeb CAN'T IMPORT any kind of published html code as it has no import facility.  You can however add html code, javascript and css by selecting the html snippet and placing it on your page the entering the code in here and clicking on Apply.  You DO NOT create a shape as you say - you use the html snippet and place your code in there.
    There are not really a lot of ways in which you can write code - if you want to enter small amounts of code, then you would use an ordinary text editor to do this such as Text Edit on a Mac or Text Wrangler.  If you want to add code to iWeb like this, then you would either use the html snippet method in iWeb itself or you would have to publish the site to a local folder from iWeb and open the relevant html page with a text editor and add the additional code in this way and then publish.  However, if he decided to add the code with a text editor, then you would have to upload the pages directly to the server using an ftp client - if you try to upload the site directly from iWeb, all the extra code will be overwritten.
    As for checking whether the site was created using iWeb, all you need do is view the site in Safari and then click on View and then select View Source Code and it will tell you.
    Even thoough extra code was added to the site and he might well have done this by publishing to a local folder and adding the code with a text editor, he should still have the domain file for the site too.
    Ask again.  I'm sure that for adding quick code, most would not want to use programmes such as Dreamweaver, but a simple text editor will suffice.  As OT already said, if he claims that he does not have the domain.sites file, then try Flux 4 which is a web design programme and has full import facilities.  At least this way, if he just gives you the published version of the site, you have some way of opening it.
    You can download a free trial of Flux 4 and you can also purchase the full version from the Mac App Store if you decide you like it.

  • 2 weeks trying to find out how to use the media live encoder in multi stream. And  I can not find an

    2 weeks trying to find out how to use the media live encoder 3.2 in multi
    stream. And  I can not find any clear instructions guide. Please from
    my soul, taught me clearly, how  I can stream to 2 different site
    using live media encoder. what I do with ftml values and the other
    one , wich everyone site give me, where should I put them, in what
    order ... everything I tried, I got an error. I realy please you,
    please !!!! thanks in advance !!

    [Moved to Flash Media Live Encoder forum.]

  • I lost my Download Stacks option. Now it is just a Download folder. Need to find out how to get the Download Stacks option back. Previous answers to this question don't make any sense to me. Please help in explicit detail. PS I'm using Mountain Lion.

    Need to know how to get it back to its original Download Stack. Previous answers to this questionin Apple Support just don't make any sense to me. I'd appreciate explicit directions on how to restore this feature. Currently it's just a Download folder... must have accidently poofed it away.
    Help!

    And if what WZZZ suggests doesn't work (and hopefully it will) move the file name below to the desktop, log out or restart and the Dock preferences with its defaults should be recreated. You'll need to re-configure it as you like it:
    com.apple.dock.plist
    It's located: in Finder hold the Alt/Option key and from the Go menu select Library>Preferences.
    If it fixes things, delete the file on your desktop.

  • HT201401 I just restored my iPhone and it worked, but it will not let me go any further (iTunes telling me "The iPhone you have connected may be damaged and cannot be activated") so I'm trying to find out how to get past this... Why is it "damaged"?

    It all started when one day all of a sudden the heat was bad here, and I sat in the car with the AC on and my phone on the dash board, charging. Next thing that happened was that when I got home I let my son play with it (which he always takes good care of it, watching youtube videos) and then later on that evening when I payed attention to the back of it, it looked super swollen. You could see where tears in the white backing of my iPhone were from whatever had caused this. I thought it was from the heat, just expanding the case. Well, it had obviously got too hot in the sun on the dashboard and over a few hours had almost got to the point of exploding. I did not know that just a little bit of heat from the sun could do that, so anyways.
    I ordered a new battery online and replaced that, in the process loosing two screws, the two at the bottom which hold the LED touch screen in place. Although it doesn't move without the screws, I do need to replace those also. Everything works fine. Buttons, touch screen, I just think there might be a small problem with the mother board, from the battery swelling and causing it to bend, or even heating the metal on it. That would suck, total bummer.. Anyways, anyone with a solution or even a bit of advice, or just a suggestion please feel free to help. I have taken it apart one last time after I restored it, and cleaned it very little with alcohol, thinking that might be a problem, but still nothing yet...
    I hope I get this phone working again, not use for a phone, but for games, music, and videos. Thank anyone for your help! It's greatly appreciated!
    HOLLY

    If things seem to be going haywire with your phone, it seems that it MAY be a software issue.
    Now, that being said, that does not necessarily mean that it is a virus. Software issues do happen sometimes. It is probably just coincidence.
    What you need to do is restore the device using iTunes. This will fix any software issues. After you have done this, you can restore from an iCloud backup.
    iCloud does not back up the actual software, so no, the "virus" would not have gotten into the backups.
    The link below provides steps on restoring your device using iTunes as well as how to restore from an iCloud backup.
    http://support.apple.com/kb/ht1766
    Don't worry! Everything should be back to normal if you follow these steps.

  • Is there a way to find out how to get the index of a column?

    Hello,
    I want to know the index of a column for example the column at the first position in a jtable is 0 so how can i get this index?
    for example: the column called "surname" is index 0 but the user can move the column. So the name stays the same but the index of the column changed. I search for a method like
    table.getColumnIndex("surname");

    I think it really depends on what the OP is trying to do. I think the program
    below offers up the possible choices pretty well.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    public class TableColumnIndexDemo extends JFrame {
         private JTable table;
         private String[] names = new String[]{ "One", "Two", "Three", "Four", "Five" };
         public static void main( String args[] ) {
              SwingUtilities.invokeLater( new Runnable() {
                   public void run() { new TableColumnIndexDemo(); }
         public TableColumnIndexDemo() {
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              DefaultTableModel model = new DefaultTableModel( names, 1 );
              table = new JTable( model );
              JButton button = new JButton( "Print indices" );
              button.addActionListener( new ActionListener() {
                   public void actionPerformed( ActionEvent e ) {
                        printIndices();
              getContentPane().setLayout( new BorderLayout() );
              getContentPane().add( button, BorderLayout.NORTH );
              getContentPane().add( new JScrollPane( table ), BorderLayout.CENTER );
              getContentPane().add( new JLabel( "Move columns around then print indices" ), BorderLayout.SOUTH );
              setSize( 300, 150 );
              setVisible( true );
              printIndices();
         private void printIndices() {
              TableColumnModel columnModel = table.getColumnModel();
              TableModel model = table.getModel();
              StringBuffer sb = new StringBuffer();
              System.out.println( "Visible order");
              for ( int k = 0; k < columnModel.getColumnCount(); k++ ) {
                   if ( k > 0 ) sb.append( ", " );
                   sb.append( k ).append( " " ).append( columnModel.getColumn( k ).getIdentifier() );
              System.out.println( sb );
              sb = new StringBuffer();
              System.out.println( "By name using getColumnIndex(TableModel,name)" );
              for( int k = 0; k < names.length; k++) {
                   if ( k > 0 ) sb.append( ", " );
                   sb.append( getColumnIndex( model, names[k] ) ).append( " " ).append( names[k] );
              System.out.println( sb );
              sb = new StringBuffer();
              System.out.println( "By name using columnModel.getColumnIndex(name)" );
              for( int k = 0; k < names.length; k++) {
                   if ( k > 0 ) sb.append( ", " );
                   sb.append( columnModel.getColumnIndex( names[k] ) ).append( " " ).append( names[k] );
              System.out.println( sb );
              sb = new StringBuffer();
              System.out.println( "Model index by visible order");
              for ( int k = 0; k < columnModel.getColumnCount(); k++ ) {
                   if ( k > 0 ) sb.append( ", " );
                   TableColumn column = columnModel.getColumn( k );
                   sb.append( column.getModelIndex() ).append( " " ).append( column.getIdentifier() );
              System.out.println( sb );
         public static int getColumnIndex(TableModel model, String name) {
             for(int i = 0; i < model.getColumnCount(); i++) {
                 if( model.getColumnName(i).equalsIgnoreCase(name) ) {
                     return i;
             return -1;
    }

  • I have spent dozens of hours over the last years trying to find out why I get the error message "...not authorized to copy" when I try and drag a download from ADE to my nook.  Why is this simple procedure not foolproof.  There are hundreds of people sear

    Typical - what on earth am I doing at this page and why was I sent here
    Now I get a message saying there is an error and my content could not be saved
    What is wrong with you people?
    How can you make such a simple operation so complicated that it is festooned with error messages
    LEARN THE MEANING OF FOOLPROOF YOU IMBICILES

    Unfortunately you've discovered too late how important it is to maintain an up-to-date backup of your iTunes library (and all other data of value).  You could, before wiping the drive, have considered making use of a commercial data recovery service that could (albeit at considerable cost) have extracted your library from the hard disk, even if virus infected.
    In the absence of that option, you will need to restore the content of your library from its original sources:
    Depending on your location, you may be able to re-download any iTunes Store purchases that are still available on the Store
    Likewise, most digital purchases from Amazon (including auto-rip copies of purchased CDs) should be available from the Amazon Cloud and via the Amazon Music application - the same may be true of other commercial sources for digital downloads
    Content imported from your CDs will have to imported again
    The specific situation that you describe regarding the music imported from your friend's external HDD suggests that either the source is badly organized and/or originates from a source other than iTunes (other media players may use alternative tags for information like artist, title, album, etc. that are not wholly consistent with how iTunes handle these).  Without details of the issues you're seeing it is difficult to suggest a remedy other than going through the media album-by-album, track-by-track, and correcting the inconsistencies.
    In the absence of a backup or access to the original library data there is no option other than painstakingly recreating your library as described above.  As you do so, you'll now realize how important creating and maintaining backups are - in my case I have at all times three separate duplicates of my library, in two different locations, where none is ever more than a week old compared to the content of my master library.

  • I am trying to set up my apple tv on a sony KDL - 40xbr4. The remote is a sony RM-V302. I plugged it into the HDMI IN on the side of the TV but cannot find out how to get to that input. I am at a winter rental property and brought my Apple TV with me.

    I am trying to set up my apple tv on a sony KDL - 40xbr4. The remote is a sony RM-V302. I plugged it into the HDMI IN on the side of the TV but cannot find out how to get to that input. I am at a winter rental property and brought my Apple TV with me. I did check internet for solutions. The instructions I found said to use a "home button" on the remote.  There isn't one. I sure would appreciate help if someone knows a solution.  My first post - hope I did this right.

    if its anything like my Sony, theres a button top left corner that upon each press i get an audible bleep and the AV inputs come up on screen, i then cycle down to whichever input i wish to select!
    in case your remote is different, the button on my remote has a square with a slightly smaller square just overlapping the first square.
    hope that helps?
    rgds Lee.

  • I am trying to find out how to assign files with particular extensions to the appropriate software. At the moment when I create a file using Word it is apparently given the extension .docx but Word doesn't recognise its own files. How do I alocate th

    I am trying to find out how to assign files with particular extensions to the appropriate software. At the moment when I create a file using Word it is apparently given the extension .docx but Word doesn't recognise its own files. How do I allocate the extension .docx to Word? There used to be a way of doing it, I think under "Preferences" but I can't seem to find it.

    Still in the same location:
    File > Get Info > Open with (select) > Change All (button)

  • I'm trying to find out how to export my apple contacts to the Salesforce software and they need to be in a csv format and I don't know if this is possible and how to do it if it is?

    I'm trying to find out how to export my apple contacts to the Salesforce software and they need to be in a csv format and I don't know if this is possible and how to do it if it is?

    I think there are third-party programs which will do that, but you can also do it with Automator:
    See the links in my post, here: https://discussions.apple.com/message/22390873#22390873
    The file or clipboard contents will be in Tab Separated vars, so you'll have to open with a spreadsheet program and save as Comma Separated Vars format.

  • The updated iPhoto program is cumbersome.  I am trying to create a Christmas card and can't figure out how to get the fold of the card on the left and not on the top of the card.  I had no trouble with this for the past two years.  Can someone help?

    The updated iPhoto program is cumbersome.  I am trying to create a Christmas card and can't figure out how to get the fold of the card on the left and not on the top of the card.  I had no trouble with this for the past two years.  Can someone help?

    Click on the Layout button lower right and choose a Vertical lyout from the dropdown

  • I have had Adobe XI for about two years and My harddrive just crashed. My backups were part of the failure so I can't get it back. I purchased it from a third part supplier and it was a download. I need to find out how to get it restored. I can send scree

    I have had Adobe XI for about two years and My harddrive just crashed. My backups were part of the failure so I can't get it back. I purchased it from a third part supplier and it was a download. I need to find out how to get it restored. I can send screen shots of all of the drive location where the drive is still good and I can see my Adobe Acrobat pro information, but the download itself is missing. NEXT STEP?

    If you are talking about Reader (you did post in the Reader forum), then just download http://get.adobe.com/reader/enterprise. However Reader is free not purchasable. You can download a trial then install using your serial number, which if you didn’t register or write down somewhere you will be out of luck to track down.
    Download a free trial or buy Adobe products | Adobe downloads

Maybe you are looking for