Sort me out! Sorting help

I am working on a project for class that simulates a card game. I need to group the cards by suit and arrange the cards in decreasing order within that suit. I am going to put all of the hearts in one array, clubs in another, and so on. However, I can not figure out how to sort the array (lets say hearts for this example) so that the numbers appear in decreasing order. The code below is my most recent snippet and it gives me an out of bounds error. FYI, the array is an array of card objects. The getValue method pulls an integer value from 1 to 13 depending on the card. PLEASE SAVE ME!!!
//Arrange the hearts in decreasing order
for(int i=0; i < hearts.length; i++){
for(int j=0; j < hearts.length; j++){
if(hearts[j].getValue() > hearts[j+1].getValue()){
temp [0]=hearts[j];
hearts[j] = hearts[j+1];
hearts[j+1] = temp [0];
}

if(hearts[j].getValue() > hearts[j+1].getValue()){
temp [0]=hearts[j];
hearts[j] = hearts[j+1];
hearts[j+1] = temp [0];
} What happens when getValue() returns 13? Figure that out and you will find the reason for your ArrayOutOfBoundsException. [Hint: walk through your code with the j=13).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • I submitted my podcast and I got an email saying error, I checked with the feed validator and got this message: This feed does not validate. line 40, column 6: Undefined item element: itunes:order, how do sort this out, someone help me please.

    I submitted my podcast and I got an email saying error, I checked with the feed validator and got this message: This feed does not validate. line 40, column 6: Undefined item element: itunes:order, how do sort this out, someone help me please.

    Ignore it. 'itunes:order' is a recent addition which FeedValidator doesn't know about. If your podcast is rejected that is unlikely to be the reason. Of course as you haven't posted the feed URL nor the text of the error message I can't make any further comment.

  • Sort with out sort command

    How can we sort the internal table with out sort command.

    DECLARE A SORTED INTERNAL TABLE.
    DATA : ITAB TYPE SORTED TABLE OF MARA WITH UNIQUE KEY MATNR.
    Now, whatever data you are inserting into ITAB will be SORTED automatically.
    You CANNOT use APPEND statement with SORTED tables, have to use INSERT statement. You don't have to use the SORT statement.
    regards,
    Ravi
    Note : Please mark all the helpful answers and close the thread if the issue is resolved.

  • R6034 error having difficulty sorting this out any help please

    Hi I've just updated my iTunes as requested now getting error message

    Try the following user tip:
    Troubleshooting issues with iTunes for Windows updates

  • SORT THIS OUT ONCE AND FOR ALL BT!

    BT,
    I'VE HAD YOUR SERVICE FOR 3 YEARS, HAD THE SAME PROBLEM ON AND OFF FOR ALL THIS TIME. AT MY PREVIOUS ADDRESS INTERNET KEPT DROPPING, HAD NEW HUB, PROMISED RESOLUTIONS ETC. I THOUGHT MOVING TO A NEW PROPERTY I WOULDN'T ENCOUNTER THE SAME PROBLEMS. WELL, HEY-HO SINCE MOVING INTO NEW PROPERTY THE PROBLEMS WITH YOUR COMPANY HAVE FOLLOWED ME HERE. I HAVE HAD SO MANY ISSUES WITH BB, VISION AND THE LANDLINE I'M AT MY WITS' END. MY INTERNET KEEPS DROPPING, ENGINEER HAS BEEN OUT TO WORK AT THE EXCHANGE & WAS PROMISED I'D HAVE NO MORE ISSUES.  2 DAYS AFTER IT WAS SUPPOSEDLY FIXED IT STARTED DROPPING AGAIN. AFTER 6/7 PHONE CALLS HAVE BEEN TOLD ENGINEER NEEDS TO COME OUT AGAIN AND I MAY NEED A NEW ROUTER. I AM SERIOUSLY ILL DUE TO YOUR COMPANY AND INCOMPETENCE. AM TIRED OF SPEAKING TO INDIA, PHONE CALLS NEVER RETURNED WHEN I EXPECT THEM. WAS TOLD MY INTERNET SPEED WOULD BE INCREASED, LIE THAT HASN'T HAPPENED. THIS IS APPALLING. COMPLAINTS NEVER ACKNOWLEDGED. DO ALL YOUR CUSTOMERS EXPERIENCE 2ND CLASS SERVICE FROM YOU??? SORT IT OUT, SORT IT OUT HEAD OFFICE GETTING CALL MONDAY. SICK N TIRED OF BEING SICK AND TIRED WITH SO-CALLED SERVICE. RUBBISH.

    Anger I would say with the CAPS on. I am sure you have already been though this, but as part of the trouble shooting process all the ground work has to be covered.
    Before covering below, how do you connect your computer(s) by ethernet cable or wireless? If wireless check to ensure that it is not the wireless that is dropping as most people mistake this for the broadband service dropping, if you are using wireless I would suggest using the ethernet cable for 48 hours to see if dropping, if connection stays working after using ethernet cable then wireless at fault. If already using ethernet cable please follow below.
    1: How many telephone sockets in use?
    2: For all the sockets in use is there a microfilter plugged in first?
    3: Do you know where your master socket is, if not check all sockets to see if it looks like the one in the picture.
    4: If it looks like the one in the picture, then unscrew both the screws and gently remove the faceplate you will see another socket inside.
    5: Using one microfilter plug that in first and only the router and telephone no other devices for 48 hours, leave router on.
    6: Within this period use the speedtester.bt.com three times a day, one morning, one afternoon and one in the evening, this will map out sync speed and ip speed..
    7: Also when speed test has been completed log in to the router to check the connection time, as it could be dropping.
    8: Post what you have completed with the trouble shooting and the speed test results one from the start and one from the end.
    If after all this and the service is still dropping I would call and explain what you have completed for trouble shooting and request to have it escalated as a repeat issue, also request to speak to a manager.
    =====================================
    Treat others the way how you liked to be treated
    =====================================

  • Well, i was on my laptop now and all of a sudden a pop up message appeared and said "your download is complete" so i went to go check it out and it was 'MacProtector'. i cant delete it and it keeps opening unwanted web pages, please help me sort this out?

    Well, i was on my laptop now and all of a sudden a pop up message appeared and said "your download is complete" so i went to go check it out and it was 'MacProtector'. i cant delete it and it keeps opening unwanted web pages, please help me sort this out someone?

    Refer to:  http://cantalktech.com/2011/05/08/mac-protector/.

  • I've tried to register as a homeschooling family with iTunes U. (The registration options weren't geared to allow me to say as much.) My application was denied. Can anyone help me sort this out?

    I've tried to register as a homeschooling family with iTunes U. (The registration options weren't geared to allow me to say as much.) My application was denied. Can anyone help me sort this out?

    Private courses support up to 50 students, so you shouldn't have to register your family.
    Have you contacted Apple support?
    http://www.apple.com/support/itunes-u/public-site-manager/contact.html

  • HELP. 3 years ago I purchased cs3. I had troubles with registering the serial number and used my university's suite instead, and (stupidly) did not sort it out. I am now wanting to subscribe to the online creative cloud with my cs3 discount. Is there any

    HELP. 3 years ago I purchased cs3. I had troubles with registering the serial number and used my university's suite instead, and (stupidly) did not sort it out. I am now wanting to subscribe to the online creative cloud with my cs3 discount. Is there any way to find / prove that I had purchased cs3 and locate a serial number? On my Adobe account it does not show my purchase of cs3 (I am guessing because of the trouble with registering my serial number). I have moved house 3 times since the purchase and am unable to locate the packaging or disk. Is there any way to prove my purchase without any serial number or showing under my Adobe account? Please help! Thanks

    The CS3 discount offer is only for retail online product, it does not include education or volume license purchases. Refer to Terms and Conditions | Adobe
    To check whether you had retail CS3 purchase, we need proof of purchase as well as serial number, without which the issue can not be resolved.
    Regards
    Rajshree

  • My phone keeps coming up as sim failed, got till november to sort this out, dont haved an apple shop nearby, tried sim replacement, What do I do!

    I've had my phone since last November, so I'm rushing to sort this out because my garuntee will run out soon! I'm in a residential college and my phone keeps Sim failing up to thirty times a day at least! had this problem ever since I got the phone, gone to the orange store and they sent me to apple, I dont have an apple store anywhere near where I live different customer services tell me different things, change your sim, update and have tried both, my temperary solution is to re boot my phone but because i dont know when it sim fials till I look at my phone, I only find out thatt I've missed inportant phone calls and old messages when I turn it back on, then five minutes later it Sim Fails again! I'm so frustrated because obvously I'm away form home and its been a buger to sort out I htink I've just ran out of choices. Got an expensive phone, on an expensive contract, when it doens't even work properly, bad signal, bad internet connection, dont know what else to do!

    Is the phone carrier locked to O2 (sounds like it is)?  Unless your friend requested they unlock it before giving it to you (ie. while it was still on an account on their network), it will be carrier locked to them.
    You can contact O2 and ask them about unlocking it (they do support unlocking) but I don't know what they will tell you now that the account is closed and it is off their network.  Regardless, they are the only ones who can help you with a phone locked to their network.

  • When i sync my ipod, i have notice that not all the music syncs and when i click on the ipod tab, some of the music has a round/two arrows?! How can i sort this out?!

    When i sync my ipod, i have noticed on the left hand side, under devices, my ipod, when i click on music, some of the songs are grey, and the others are black. The ones which are grey have a round circle with two arrows in. These are the ones which havent copied onto my ipod. I had no problem before until recently and all of a sudden! Can anyone please help me sort this out so that all my music will transfer onto my ipod, i have been trying for over a week!

    Never mind, the problem just fixed itself when i searched for an artist that wasn't there. That was odd.

  • Sort Not working - Please help

    Hello,
      I have design2003 parameter. Im displaying table with following logic. Problem is it is not activating SORT icon thats comes in table header text line which sorts the column. What could be wrong? Please help.
    <htmlb:tableView id              = "table_prod_cat"
                             design          = "alternating"
                             fillUpEmptyRows = "true"
                             headerText      = "Category_List"
                             headerVisible   = "true"
                             onRowSelection  = "prod_cat_rowselection"
                             selectionMode   = "none"
                             table           = "<%= lt_prod_cat_list %>"
                             visibleRowCount   = "<%= l_sprec_display %>"
                             width           = "100%" >
               <htmlb:tableViewColumns>
                <%-- Product Category ID --%>
                <htmlb:tableViewColumn columnName  = "product_cat"
                                       onItemClick = "prod_cat_id_itemclick"
                                       width       = "80"
                                       sort        = "X"
                                       title       = "<B>Category</>"
                                       type        = "link" />
                <%-- Product Category Description --%>
                <htmlb:tableViewColumn columnName = "CATEGORY_TEXT"
                                       title      = "<B> Category Text</>"
                                        sort      = "X"
                                        width      = "200" />
                <htmlb:tableViewColumn columnName = "PRODUCT_GRP"
                                       title      = "<B>Product Group</>"
                                        sort      = "X"
                                       width      = "200" />
                <htmlb:tableViewColumn columnName = "PRODUCT_SGRP"
                                       title      = "<B>Product Sub-Group</>"
                                        sort      = "X"
                                       width      = "200" />
              </htmlb:tableViewColumns>
             </htmlb:tableView>

    Ajay,
    You should use sort = "server" or sort = "none" .
    sort     -               Use this attribute to activate sorting for the
    individual rows and to determine who is responsible for the sorting.
    NONE (default, there is no sorting), SERVER (HTMLB carries out the
    sorting) and APPLICATION (the application carries out the sorting) If
    you specify SERVER, you should also set the attributes keyColumn and
    onHeaderClick.
    I have changed your code..use this code and let me know if you get any issue.
    <htmlb:tableView id = "table_prod_cat"
    design = "alternating"
    fillUpEmptyRows = "true"
    headerText = "Category_List"
    headerVisible = "true"
    onRowSelection = "prod_cat_rowselection"
    selectionMode = "none"
    <b>sort          = "server"</b>
    table = "<%= lt_prod_cat_list %>"
    visibleRowCount = "<%= l_sprec_display %>"
    width = "100%" >
    <htmlb:tableViewColumns>
    <%-- Product Category ID --%>
    <htmlb:tableViewColumn columnName = "product_cat"
    onItemClick = "prod_cat_id_itemclick"
    width = "80"
    <b>sort = "true"</b>
    title = "<B>Category</>"
    type = "link" />
    <%-- Product Category Description --%>
    <htmlb:tableViewColumn columnName = "CATEGORY_TEXT"
    title = "<B> Category Text</>"
    <b>sort = "true"</b>
    width = "200" />
    <htmlb:tableViewColumn columnName = "PRODUCT_GRP"
    title = "<B>Product Group</>"
    <b>sort = "true"</b>
    width = "200" />
    <htmlb:tableViewColumn columnName = "PRODUCT_SGRP"
    title = "<B>Product Sub-Group</>"
    <b>sort = "true"</b>
    width = "200" />
    </htmlb:tableViewColumns>
    </htmlb:tableView>
    Thanks!
    Lakshmikandh<b></b>
    Message was edited by:
            Lakshmikandh Chinnasamy

  • And when i try to Re-install itunes i get a message from itunes ERROR 7 (windows error 1114), now how do i sort this out ???

    and when i try to Re-install itunes i get a message from itunes ERROR 7 (windows error 1114), now how do i sort this out ???

    Hey deepakmenonfrompune,
    Thanks for the question. I understand that you are experiencing issues with iTunes for Windows. The following resource may help to resolve your issue:
    iTunes 11.1.4 for Windows: Unable to install or open
    http://support.apple.com/kb/TS5376
    Some Windows customers may experience installation issues while trying to install or open iTunes 11.1.4.
    Symptoms may include:
    "The program can't start because MSVCR80.dll is missing from your computer"
    "iTunes was not installed correctly. Please reinstall iTunes. Error 7 (Windows Error 126)”
    "Runtime Error: R6034 - An application has made an attempt to load the C runtime library incorrectly"
    "Entry point not found: videoTracks@QTMovie@@QBE?AV?$Vector@V?$RefPtr@VQTTrack@@@***@@$0A@VCrashOnOverf low@@***@@XZ could not be located in the dynamic link library C:\Program Files(x86)\Common Files\Apple\Apple Application Support\WebKit.dll”
    Resolution
    Follow these steps to resolve the issue:
    Check for .dll files
    1. Go to C:\Program Files (x86)\iTunes and C:\Program Files\iTunes and look for .dll files.
    2. If you find QTMovie.DLL, or any other .dll files, move them to the desktop.
    3. Reboot your computer.
    Note: Depending on your operating system, you may only have one of the listed paths.
    Uninstall and reinstall iTunes
    1. Uninstall iTunes and all of its related components.
    2. Reboot your computer. If you can't uninstall a piece of Apple software, try using theMicrosoft Program Install and Uninstall Utility.
    3. Re-download and reinstall iTunes 11.1.4.
    Thanks,
    Matt M.

  • Sort a string :: Please help.

    Hello Everyone,
    I am having this very simple problem of sorting a String. please help.
         static String sortString(String str){
              List list = Arrays.asList(str);                    
              Collections.sort(list);
              for(int i=0, n=list.size();i<n;i++){
                   System.out.println(","+ list.get(i));
    The function is supposed to take a String and sort it & print it out. This should be simple. Where am I making mistakes? Please help!!

    Hello Everyone,
    I am having this very simple problem of sorting a String. please help.
         static String sortString(String str){
              List list = Arrays.asList(str);                    
              Collections.sort(list);
              for(int i=0, n=list.size();i<n;i++){
                   System.out.println(","+ list.get(i));
                   return str;
    The function is supposed to take a String and sort it & print it out. This should be simple. Where am I making mistakes? Please help!!

  • Podcast not able to download- EMERGENCY- how can I sort this out?

    i'm not able to download any podcasts as all of the 'subscribe' and 'get episode' buttons next to the podcast are grey and are unaffected when i click them. COuld this be due to a lack of programming on my computer, or something else (I have added more money to my account but this hasn't had an affect)?
    Any suggestions or experiences will be very much appreciated.
    Thank You

    Yeah Im having this problem as well. Please can someone help?
    Have u sorted it out yet> If so, can U please tell me how!?!

  • I have just bought a 2011 iMac (2.5 ghz, 4gb) and logic express 9, and when i installed logic and tried to run it i had a message saying 'you can't use this version of the application logic express with this version of Mac OS X. How do i sort this out!?

    I have just bought a 2011 iMac (2.5 ghz, 4gb) and logic express 9, and when i installed logic and tried to run it i had a message saying 'you can't use this version of the application logic express with this version of Mac OS X. How do i sort this out!? It is very frustrating as the main reason i have bought  a mac is to use logic! Any help would be great as i am a complete novice when it comes to Macs!

    You're probably on OS X Lion?
    I had the same problem as you. I used Software Update to update Logic Express to the latest version, and then it ran without any problems.

  • Absolutely livid. Apple, sort this out.

    So my iPhone has been playing up for a few days, anytime I attempted to open an app it would open for less than a second then go back to the home screen. Naturally I booked in with the Apple Genius' to get it fixed. I went yesterday and they tried several things but finally said they would just have to restore the iPhone, deleting all my data (I agreed they could do this seeing as I have everything backed up/synced with my laptop and they told me that my apps would be put back on my phone when I synced it with the back up on my laptop). However, after trying SEVERAL times, I have been unable to recover anyting. Not one single photo, contact, app..nothing. I definitely went on to iTunes and took the correct steps to get everything that I had backed up on to my iPhone 4, yet I still have nothing on my iPhone. I'm not an idiot. I know problems occur that can wipe data off things like smart phones and computers, hence why my computers and laptops are all backed up and my iPhone. I then checked on the iTunes Store to try and find my purchased items but apparently I've never purchased anything on my account! I have apps that I've done so much work on and they've been deleted, photos I can't ever get back thanks to you Apple. Music and apps that I spent my money on and what I'm supposed to purchase them again and start over? No. Seriously, sort this out. I didn't spend a load of money on an iPhone and on iTunes to have this happen.

    You are not addressing Apple here. This is a user to user help forum only.
    No iTunes content nor photos transferred from your computer are included with the iPhone's backup. All iTunes content on your iPhone - all music, movies, tv shows, audio and print books, and 3rd party apps should be in your iTunes library on your computer. 3rd party apps can be re-downloaded again and you won't be charged for a purchased app as long as you use the same iTunes account to re-download the app that was used to purchase the app originally. Not so with music and video which can be downloaded once, but all should be in your iTunes library regardless along with your iTunes library included with your computer's backup.
    Although photos/videos in the Camera Roll are included with your iPhone's backup, photos/videos in the Camera Roll can and should be imported by your computer as with any other digital camera.
    Contacts are included with the backup as well but are designed to be synced with a supported address book app on your computer. Not a good idea to depend on an iPhone or any cell phone alone for your contacts which can be lost or stolen.

Maybe you are looking for

  • TS3230 "Safari quit unexpectedly while using the QuartzCompser plug-in"

    My computer ran some updates, restarted, and now I can't use Safari at all due to the above error message which I get every time I try to open it.   I wish I would've returned this mini when I still could as I've had nothing but issues with the speed

  • With dynamic CreateViewObject How To "Navigate N rows at a time using DataTags" fails

    I have worked with the example on this link: http://otn.oracle.com/docs/products/jdev/howtos/jsp/traverse_n.ht ml It works fine in case I am using the View Object created in the Package as the example is using. However, this sample does not navigate;

  • I need help with the dates on a macbook

    HI i've recently bought a macbook a1260, the chap has sold it too me for £330 on the basis that he bought it brand new back in 2011 making it just 4 years old, my problem is all im getting is that it's the '08 model, which makes me think that it is w

  • Email server security settings for Thunderbird

    Hi - my first message to the Forum so hope I am in the right section. I'm on Windows 8. My email is working fine via an email client (Thunderbird). However, the server security settings suggested by BT instructions for T/Bird seem very weak to me....

  • UCCX 8.0 HA Deployment Type

    All, I am testing UCCX 8.0 PRE HA and have the following questions about HA deployment Type. Before UCCX 8.0, UCCX only supports HA on the same Campus LAN, i.e. two servers should be in the same subnet. UCCX 8 now supports HA over WAN. From UCCX 8.0