Help with sort

So I have a class called Token and a class called TokenArray. I have a sort function to sort an array of Tokens. I'm pretty new to java so I assumed a sort function would work the same as in C but for some reason it deletes the data instead of switching them. Here is my function:
public void sortTokens() {
          boolean swapped = false;
          Token temp;
          do {
               for(int i = 0; i < m_numTokens-1; i++) {
                    if(m_tokenArray.compareToIgnoreCase(m_tokenArray[i+1]) > 0) {
                         temp = m_tokenArray[i];
                         m_tokenArray[i] = m_tokenArray[i+1];
                         m_tokenArray[i+1] = temp;
                         swapped = true;
          } while (swapped);
Can someone tell me why this isn't working?
null
Message was edited by:
java_dres

No, you have to tell us why it is not working. Then we might be able to tell you what the problem is. Do you get errors when you compile it? Or when you run it? Or does it do something that you didn't expect?
If so, tell us about those errors, expectations, what happened, and so on.
Personally I would not write any sorting code at all, given the existence of the Arrays.sort() method. Unless this is homework and you aren't allowed to use that.

Similar Messages

  • Help with Sort function in Terminal

    Hello all... this is my first post on here as I'm having some trouble with some Termianl commands. I'm trying to learn Terminal at the moment as it is but I would appreciate some help with this one....
    I'm trying to sort a rather large txt file into alphabetical order and also delete any duplicates. I've been using the following command in Terminal:
    sort -u words.txt > words1.txt
    but after a while I get the following error
    sort: string comparison failed: Illegal byte sequence
    sort: Set LC_ALL='C' to work around the problem.
    sort: The strings compared were `ariadnetr\345dens\r' and `ariadnetr\345ds\r'.
    What should my initial command be? What is Set LC_ALL='C'?
    Hope you guys can help?

    Various languages distinct sorting - collation - sequences. 
    The characters can and variously do sort differently, depending on what language is involved. 
    Languages here can include the written languages of humans, and a few settings associated with programming languages.  This is all part of what is known as internationalization and localization, and there are are various documents around on that topic.
    The LC_ALL environment variable sets all of the locale-related settings en-mass, including the collation sequence that is established via LC_COLLATE et al, and the sort tool is suggesting selecting the C language collation.
    Here, the tool is suggesting the following syntax:
    LC_ALL=C sort -u words.txt > words1.txt
    This can also be done by exporting the LC_ALL, but it's probably better to just do this locally before invoking the tool.
    Also look at the lines of text in question within the files, and confirm the character encoding of the file.
    Files can have different character encodings, and there's no reliable means to guess the encoding.  For some related information, see the file command:
    file words.txt
    ...and start reading some of the materials on internationalization and localization that are posted around the 'net. Here's Apple's top-level overview.
    In this case, it looks like there's an "odd" character and probably an å character on that line and apparently the Svenska ariadnetrådens. 
    Switching collation can help here, or - if the character is not necessary - removing it via tr or replacing it via sed can be equally effective solutions. 
    Given it appears to be Svenska, it might work better to switch to Svenska collation thanto  the suggested C collation.
    I think that's going to be sv_SE, which would make the command:
    LC_ALL=sv_SE sort -u words.txt > words1.txt
    This is all generic bash shell scripting stuff, and not specific to OS X.  If you haven't already seen them, the folks over at tldp have various guides including a bash guide for beginners, and an advanced bash scripting guide - both can be worth skimming.  They're not exactly the same as bash on OS X and some specific commands and switches can differ, and as bash versions can differ, but bash is quite similar across all the platforms.

  • Help with sorting a list

    Hi,
    can anyone help me with sorting of a list by date?
    I have like 5 objects in the list, 4 are string and one is list.
    I want to sort them by Date..
    How can I do that?
    I don't know if I can use CompateTo?? I am new to programing, I would appreciate if anyone can explain with sample code.
    Your help is appreciated.

    ASH_2007 wrote:
    Hey thanks for your response, but there is a little problem with what I said earlier.
    Actually my List is a type of record (it's called Employee record)
    Here what exactly I have:
    for Iint i=0; i< employeeRecord.getList().size(); i++)
    EmployeeRecord emp = employeeRecord.getList().get(i);
    //so if I can not hold my date information in an object, coz it's says type mismatch
    //I am not sure how can I do this?
    }Can you please help with sample code?
    Thanks tonsEither cast or learn about generics. Also, use an Iterator or a foreach loop, NOT get(i).
    [Collections tutorial|http://java.sun.com/docs/books/tutorial/collections/]
    [Generics intro|http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html]
    [Generics tutorial|http://java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf]
    Foreach

  • Help with sort please

    I have my first java assignment to hand in on monday and im having a few problems and was wondering if someone could help me solve the problem.
    I have to display the most frequently occuring double of a set of dice the problem is that I seem to be only able to display the amount of times it was rolled rather than the actually double.
    I would really appreciate some help in this matter.
    Thanks
    import cs1.*;
    import java.util.*;
    public class TestDice
              public static void p(String s)
                   System.out.print(s);
              public static int sort(int[] dubs)
                     int x,y,max=0,temp;
                     for (x = 0; x < 6 ; x++)
                       max = x;
                        for (y = x+1; y < 6; y++)
                              if (dubs[y] > dubs[max])
                                max = y;
                        temp = dubs[x];
                        dubs[x] = dubs[max];
                        dubs[max] = temp;                 
                   return max;
              public static void main(String[] args)
               PairOfDie dice; 
               int noRolls,x,doubles=0;
                 int [] dubs;
                 dice = new PairOfDie();                   
               dubs = new int[6];
                 p("\n\n");
               for (noRolls=0; noRolls < 1000; noRolls++)
                   dice.roll();
                   p("" + dice.getDice1() + "," + dice.getDice2() + "   ");
                      for (x=0;x<6;x++)
                           if(dice.getDice1() == (x+1) && dice.getDice2() == (x+1))
                                 dubs[x]++;
                 occurences(dubs);              
                 p("\n\n\n(B) Display the most frequently occuring double or doubles = " +  dubs[0]);
                 histogram(dubs);
            }//End of Main
              public static void occurences(int[] dubs)
                      int x,max;
                    p("\n\n(A) Count and display the occurences of each of the doubles");
                      p("\n\n Double\tOccurences\n ------\t----------\n");
                      for (x=0;x<6;x++)
                          p("\n   " + (x+1) +" \t\t    " + dubs[x]);
              }//End of Occurences
              public static void histogram (int [] dubs)
                   int y,x;
                   p("\n\n\n(C) Draw a Histogram of the occurences of each of the doubles");
                   p("\n\n Double\t    Occurences\n ------\t    ----------\n");
                   for(y=0;y<6;y++)
                        p("\n   " + (y+1) + "\t\t    ");
                        for (x=1; x<=dubs[y];x++)
                             p("*");
                   p("\n\n");
              }//End of Histogram
    }//End of Class

    > No I cant thats why I am doing a course in it at the moment,
    I said, then at the end. So if mlk can't read, then you can't program. I also posted a smiley to emphasize it was more of a cynical remark of me.
    > I was not looking for someone to do my
    homework I had a question regarding a sorting
    problem.
    I'm sure you aren't, but I don't see a question in there. I can only see a bunch of lines without comments. You also didn't provide some sample in/output, but only wrote "I want to do Y, but are only able to do X...".
    I have told you this before:
    Try to look at your own post as if you had never seen it, and are not familiar with the exact assignment. Would you be able to post a meaningfull answer to your "question"? I don't think so.
    In previous posts you were given numerous links to basic tutorials (including sorting tutorials) which you apparently didn't read. That's too bad.
    > Im sure everyone wont be as ignorant
    What do you mean by that?

  • Help with Sort sequence and reset preferences

    Hi,
    I have checked the "sort" checkboxes and the "sort sequence" in my first 5 columns of the sql report. The sequence are straight 1,2,3,4,5.
    I have also create two buttons. The first one that will trigger a pl/sql that would execute RESET_USER_PREFERENCES built-in package, and a second button that just submit. The page submit to itself by default.
    It appears that the Reset Preferences does not follow the "sort sequences". Take a look at: http://htmldb.oracle.com/pls/otn/f?p=15031:2:
    Check what happen with the second column OBJECT NAME: I expect to see CUSTOM_AUTH first and then CUSTOM_HASH second once you Reset User Preferences. Interesting is that when I just press the refresh button, then i get what I want, but i think that is just coincidence as there is not guarantee that the data are going to be displayed in that order once you start deleting and inserting in the middle.
    Any help in order to understand the "sort sequences" concept is appreciated.
    Thanks

    Anybody?

  • Help with "sorting by composer"

    Hello to all of you,
    I'm writing this subject to get some help. I'm trying to sort my music by composers on iTunes 11. So, I write down the "Composer" like "Johann Sebastian Bach", and everything is fine on the composer view : I have "Johann Sebastian Bach" :
    Then I'm going to the "Sort by composer" Field, and I write "Bach" for all the Johan Sebastian Bach Music. I'm closing iTunes and reopen it (or else, composer view is not refreshed - perhaps there is a trick to force refreshing ?) and TADAM, my Bach entry becomes two :
    I've tried to change the view with Option+J, but nothing works, I've got two Johann Sebastian Bach, and two Bach/Busoni.
    So I'm cleaning the "sort by composer" field, and the two Johan Sebastian Bach becomes one entry again.
    It does the same with a lot of others composers. Don't know how to get the things right...
    Could someone help me ?
    Thanks in advance.

    Hi,
    Try adding Bach, Bach Busoni, Bach Hess etc in sort by composer field. Does this help.
    Jim

  • Help with "Sort Artist" please

    Hi all
    What I'm trying to do is use iTunes to make it so that tracks that are by different artists appear under the same artist when I go through the "Artist" field on my iPod Touch.
    For example, I've got songs that are by Prince & the Revolution, songs that are by Prince & the New Power Generation, songs that are by Prince on his own, and songs that are by O(+>. I want iTunes to know that they are by different artists, but I want them to all appear under Prince in the alphabetical list on my iPod. Am I explaining this right?
    So, when I look at my iPod, I go to Prince, and everything by all those other "artists" are under that name, even though the iPod still knows they are credited differently.
    I thought the "Album Artist" field would do it, like you use for Various Artist albums. But the "Album Artist" field doesn't even appear as an option on my iPod screen, only in iTunes. So I tried the "Sort Artist" field, which put all the various versions of Prince together in the list but still listed them separately.
    I realize I could simplify my own life by just making the basic "Artist" field all the same, which would remove the problem. But that's not strictly accurate, is it? The NPG aren't the Revolution, and I should be able to credit them differently. But I also want, for convenience's sake, to be able to shuffle around all the various versions of Prince all together without having to create a playlist to do it.
    Assuming any of that makes sense, does anybody have any advice?
    thanks
    lvsxy808

    > No I cant thats why I am doing a course in it at the moment,
    I said, then at the end. So if mlk can't read, then you can't program. I also posted a smiley to emphasize it was more of a cynical remark of me.
    > I was not looking for someone to do my
    homework I had a question regarding a sorting
    problem.
    I'm sure you aren't, but I don't see a question in there. I can only see a bunch of lines without comments. You also didn't provide some sample in/output, but only wrote "I want to do Y, but are only able to do X...".
    I have told you this before:
    Try to look at your own post as if you had never seen it, and are not familiar with the exact assignment. Would you be able to post a meaningfull answer to your "question"? I don't think so.
    In previous posts you were given numerous links to basic tutorials (including sorting tutorials) which you apparently didn't read. That's too bad.
    > Im sure everyone wont be as ignorant
    What do you mean by that?

  • Help with sort on OLAP cubes

    Hi,
    I have a requirement to provide a D4O report where one of the cube measures is sorted desc. As I have explored on discoverer, I don't think my problem will be solved on the report side.
    Can I create a sort on the cube but this sort will not affect the cube's default sort? This a new report requirement on an existing cubes and I was thinking if I can have a sort in the cube where it will not affect any of the existing reports. Do I need to create a new measure for this? If so, how will I populate the measure?
    Example:
    Dimensions : TIME, GEOGRAPHY, CUSTOMER
    Cube Measures: Amount1, Amount2, TotalAmount
    Desired output on the report:
    Crosstab report where the rows are : Customer , Amount1, Amount2, TotalAmount
    PageItem: Time and Geography
    Sort on Total Amount desc.
    How to populate a new sort-measure such that it will be for all hierarchies of the dimensions in the cube?
    Any help will really be appreciated.
    Cheers,
    Gina

    Hi Gina,
    This can in fact be done using Discoverer, within the Query Builder. But you cannot sort the cube, this does not make sense from an OLAP perspective. You need to define a sort for each of your dimensions.
    In query builder, in the "Selected" panel on the right side of the dimensions tab there is a "Sort" button at the bottom of the selected list. Clicking on this button will launch the sort dialog. Click on the "Sort Members By:" radio button to enable the buttons on the right side of the dialog, then click on the "Add" button.
    In the "Sort By" pulldown, you will find a list showing the available sort options, such as: name, attribute values, measures included in the query, and a "more" option that will allow you to select any measure not currently included in the query. If you select the requiered measure "Total Amount", set the "Direction" to descending then the last step is to determine the QDR for the sort - that is the dimension selections for the other dimensions that make up the measure "Total Amount". For any dimensions that are on the page edge, or where the dimension is to the left of the dimension being sorted when more than one dimension is in the row edge, the QDR selector will allow a "For Each" selection which will make the sort dynamic for those dimensions. This "For Each" feature seems to be nicely hidden and not really covered in any of the documentation but is a very powerful feature and can be used in query filters as well, such as Top 10, Bottom 10 etc. In this case, using it in a sort, as the user selects a new page member, the sort will be re-applied. For other dimensions, such as the column edge you will have to pick a specific dimension member.
    You will need to repeat this process on each of your dimensions - Time, Geography and Customer (as an FYI, I would expect Customer and Geography to be the same dimension?). When you apply the sort, it will adhere to the hierarchy for your dimension, so as your drill down the members at each level will be correctly sorted using the measure "Total Amount".
    Hope this helps.
    Keith Laker
    Oracle EMEA Consulting
    OLAP Blog: http://oracleOLAP.blogspot.com/
    OLAP Wiki: http://wiki.oracle.com/page/Oracle+OLAP+Option
    DM Blog: http://oracledmt.blogspot.com/
    OWB Blog : http://blogs.oracle.com/warehousebuilder/
    OWB Wiki : http://wiki.oracle.com/page/Oracle+Warehouse+Builder
    DW on OTN : http://www.oracle.com/technology/products/bi/db/11g/index.html

  • Help with sorting files

    If anyone could give me a hand with this task it would be greatly appreciated:
    Situation:
    I have many albums that each have multiple discs. When I load my iPod it automatically shows each disc displayed as a separate ablum. I know I can group all the songs into the same album by editing the "info" and use the same album name for all the tracks (essentially deleting "[disc 1]" or "[disc 2]"). However, I want to create another sorting query so that after I click on the album title, another screen pops up that shows "Disc 1, Disc 2, Disc 3" and then I can click on each disc individually to view the tracks.
    Is this possible?

    there aren't really any problems just that instead of it showing under "Phish"
    LivePhish Vol. 7 (disc 1)
    LivePhish Vol. 7 (disc 2)
    LivePhish Vol. 7 (disc 3)
    I would like it to show:
    LivePhish Vol. 7 ...(which I can easily do by editing the info)
    then after you click on that it would show:
    Disc 1
    Disc 2
    Disc 3

  • Need help with sort

    I need to do an iterate thru records and then allow end user to sort by clicking on table cell header ex.
    name employeenumber dept social sec are the headers. a search is performed and brings back employee name, etc and fills a table cell. the column headers are clicked and results are displayed based on that header. I need to build a way to iterate (which I have) but need to sort also. any suggestions?

    If you're using SQL to pull back your data I would recommend passing an "orderBy" flag when you click on the column heading. Then in your Java code that calls your SQL you can set the "Order By" value to a field name and your data will come back sorted. This would be my first suggestion.
    If this doesn't work for you, take a look at the java.util.Comparator interface.
    Hope this helps!
    DesQuite

  • Help with sorting a query

    Hi,
    I have one table (ctry) with a two columns as below
    ctry - varchar2(2)
    zone - varchar2(6)
    SE
    SE1:1
    SE
    SE1:2
    SE
    SE1:3
    SE
    SE1:4
    SE
    SE1:10
    SE
    SE1:11
    SE
    SE1:5
    If I sort as below
    select ctry, zone
    from ctry
    order by ctry, zone
    I got result as below
    ctry - varchar2(2)
    zone - varchar2(6)
    SE
    SE1:1
    SE
    SE1:10
    SE
    SE1:11
    SE
    SE1:2
    SE
    SE1:3
    SE
    SE1:4
    SE
    SE1:5
    I want result as below
    ctry - varchar2(2)
    zone - varchar2(6)
    SE
    SE1:1
    SE
    SE1:2
    SE
    SE1:3
    SE
    SE1:4
    SE
    SE1:5
    SE
    SE1:10
    SE
    SE1:11
    Is that possible at all when type is varchar2?
    Example table/data:
    create table ctry
    ctry varchar2(2),
    zone varchar2(6)
    insert into ctry values('SE', 'SE1:1');
    insert into ctry values('SE', 'SE1:2');
    insert into ctry values('SE', 'SE1:3');
    insert into ctry values('SE', 'SE1:4');
    insert into ctry values('SE', 'SE1:10');
    insert into ctry values('SE', 'SE1:11');
    insert into ctry values('SE', 'SE1:5');

    Hi,
    So, you have a number stored at the end of a VARCHAR2 column, and you want to threat it as a number when sorting.
    Pleiadian and Blushadow showed hos to actually convert that part of the string to a NUMBER.  If the part of the string after the ':' is not a number, even if that happens on only 1 row, row will get no results other than an error message.  To guard against that, you can pad just the part after the ':' with '0's, like this:
    SELECT    *
    FROM      ctry
    ORDER BY  REGEXP_REPLACE ( REGEXP_REPLACE ( zone
                                              , '(\d+$)'
                                              , '00000\1'
                             , '0+(\d{6})'
                             , '\1'
    The inner REGEXP_REPLACE adds 5 '0's before the group of digits at the end of the string.  (Since the column is defined as VARCHAR2 (6), you'll never have to add more than 5 '0's to get all the sub-strings to the same length.)
    The outer REGEXP_REPLACE removes extra '0's, so that all the numbers that were padded to more than 6 digits are now exactly 6 digits.
    As Blushadow siad, this is only a way of coping with the problem, not solving it.  If the part of the zone after the ':' needs to be treated like a NUMBER, then it should be in a NUMBER column.  Cramming it into the same column with 'SE1' seems to violate First Normal Form.  Why not split the zone into 2, or possibly more, columns?  If you must leave it as 1 column, can you store it in a useable form, so that you don;t need to ask questions like this?  If you must store the data exactly as posted, then add another column that reflect the sort order.

  • Helping with Sorting

    I have my albums sorted in iTunes by album artist and then by year. I have encountered problems when sorting box sets that involve multiple artists. Specifically, I have a set that has many artists with recordings from different years. The album artist is "Various Artists" and the years vary. The first track on disc three is older than the first track on disc two. This results in disc three coming before disc two. Any ideas on how to fix this without simply removing the dates of the first tracks on each disc? I know that if I have two discs by the same artist from the same year, I can simply reverse the order by changing the titles in the sort field, but I know of no corresponding way to address this for "Various Artists" albums. Thanks.

    I have my albums sorted in iTunes by album artist and then by year. I have encountered problems when sorting box sets that involve multiple artists. Specifically, I have a set that has many artists with recordings from different years. The album artist is "Various Artists" and the years vary. The first track on disc three is older than the first track on disc two. This results in disc three coming before disc two. Any ideas on how to fix this without simply removing the dates of the first tracks on each disc? I know that if I have two discs by the same artist from the same year, I can simply reverse the order by changing the titles in the sort field, but I know of no corresponding way to address this for "Various Artists" albums. Thanks.

  • Need help with sorting records in primary and secondary databases

    Hi,
    I would like to store data into primary and secondary db in different order. For the main primary, I want it to be ordered by login_ts instead of uuid which is the key.
    For the user secondary database, I want it to be ordered by sip_user. For the timestampe secondary db, I want it to be ordered by login_ts.
    This is what I have right now,
    this is for main
    uuid=029ae227-a188-4ba8-aea4-7cbc26783d6 sip_user=200003 login_ts=1264327630 logout_ts=
    uuid=22966f76-8c8a-4ab4-b832-b36e8f8e14d sip_user=200003 login_ts=1264327688 logout_ts=
    uuid=e1846e4a-e1f5-406d-b903-55905a2533a sip_user=200003 login_ts=1264327618 logout_ts=
    uuid=e2f9a3cb-02d1-47ff-8af8-a3a371e20b5 sip_user=200003 login_ts=1264327613 logout_ts=
    this is for user search
    uuid=029ae227-a188-4ba8-aea4-7cbc26783d6 sip_user=200003 login_ts=1264327630 logout_ts=
    uuid=22966f76-8c8a-4ab4-b832-b36e8f8e14d sip_user=200003 login_ts=1264327688 logout_ts=
    uuid=e1846e4a-e1f5-406d-b903-55905a2533a sip_user=200003 login_ts=1264327618 logout_ts=
    uuid=e2f9a3cb-02d1-47ff-8af8-a3a371e20b5 sip_user=200003 login_ts=1264327613 logout_ts=
    this is for timestamp
    uuid=029ae227-a188-4ba8-aea4-7cbc26783d6 sip_user=200003 login_ts=1264327630 logout_ts=
    uuid=22966f76-8c8a-4ab4-b832-b36e8f8e14d sip_user=200003 login_ts=1264327688 logout_ts=
    uuid=e1846e4a-e1f5-406d-b903-55905a2533a sip_user=200003 login_ts=1264327618 logout_ts=
    uuid=e2f9a3cb-02d1-47ff-8af8-a3a371e20b5 sip_user=200003 login_ts=1264327613 logout_ts=
    but what I want is :
    this is for main
    uuid=e2f9a3cb-02d1-47ff-8af8-a3a371e20b5 sip_user=200003 login_ts=1264327613 logout_ts=
    uuid=e1846e4a-e1f5-406d-b903-55905a2533a sip_user=200004 login_ts=1264327618 logout_ts=
    uuid=029ae227-a188-4ba8-aea4-7cbc26783d6 sip_user=200003 login_ts=1264327630 logout_ts=
    uuid=22966f76-8c8a-4ab4-b832-b36e8f8e14d sip_user=200005 login_ts=1264327688 logout_ts=
    this is for user search
    uuid=e2f9a3cb-02d1-47ff-8af8-a3a371e20b5 sip_user=200003 login_ts=1264327613 logout_ts=
    uuid=029ae227-a188-4ba8-aea4-7cbc26783d6 sip_user=200003 login_ts=1264327630 logout_ts=
    uuid=e1846e4a-e1f5-406d-b903-55905a2533a sip_user=200004 login_ts=1264327618 logout_ts=
    uuid=22966f76-8c8a-4ab4-b832-b36e8f8e14d sip_user=200004 login_ts=1264327688 logout_ts=
    this is for timestamp
    uuid=e2f9a3cb-02d1-47ff-8af8-a3a371e20b5 sip_user=200003 login_ts=1264327613 logout_ts=
    uuid=e1846e4a-e1f5-406d-b903-55905a2533a sip_user=200003 login_ts=1264327618 logout_ts=
    uuid=029ae227-a188-4ba8-aea4-7cbc26783d6 sip_user=200004 login_ts=1264327630 logout_ts=
    uuid=22966f76-8c8a-4ab4-b832-b36e8f8e14d sip_user=200004 login_ts=1264327688 logout_ts=
    Right now, I have:
    int compare_login_ts(dbp, a, b)
         DB *dbp;
         const DBT a, b;
         int time_a = 0;
         int time_b = 0;
         time_a = atoi ( (char *)a->data);
         time_b = atoi ( (char *)b->data);
         return time_a - time_b ;
    for the timestamp secondary, I set that compare function:
              if ((ret = (*sdb)->set_bt_compare(*sdb , compare_login_ts )) != 0){
    Does anyone know how can I make it sorted according?

    Hi,
    The DB->set_bt_compare() is used to compare keys in Btree database. In the callback function, both the DBTs are key, but not data. Please refer to http://www.oracle.com/technology/documentation/berkeley-db/db/api_reference/C/dbset_bt_compare.html.
    If you want any field in the data to be sorted, you might create a secondary index on it and define the compare function as you wish.
    Regards,
    Emily Fu, Oracle Berkeley DB

  • Help with sorting a deck class

    I am using this from a card class...and am trying to sort the cards in numeric order, but keep getting errors
    public class Deck
    private int top;
    private int count;
    private int deckSize;
    Card [] cards=new Card[53];
    public Deck()
    for (int x=0; x<cards.length; x++)
    cards[x]=new Card();
    deckSize++;
    for (int z=0; z<cards.length; z++)
    for (int x=0; x<4; x++)
    if(cards[z].suit==x)
    for (int y=1; y>14; y++)
    if (cards[z].value==y)
    int cardLen=cards.length;
    Card temp=new Card(cards[z.suit],cards[z.value]);
    cards[z]=cards[cardLen-z-1];
    cards[cardLen-z-1]=temp;
    }

    tjacobs01 wrote:
    Create a java.util.Comparator for your cards, and then use Arrays/Collections.sortArr, ye mateys! Swap the deck!

  • Can anyone help with game center I cannot accept or request friends

    Hi can anyone help with sorting this problem out, I cannot accept or request friends via game center, Any help would be much appreciated. I get request and when I click on accept friends, nothing happens, when I go to game center it says no friends.

    Thanks Martin. I'm waiting to hear back but I believe he has the Vixia HF S10 or S11. It's a flash-drive HD camcorder. I have heard that the lousy software that comes with the Canon's for windows forced the clips to downsample. I'm going to try to Log and Capture directly from him camcorder. The (canon) device only has a USB port and I didn't think USB worked on macs for video.
    My video clips are 1920x1080 AIC, @29.97 fps.
    His clips are 720x404 mpeg2 muxed. It doesn't tell me anything else.
    In MPEG Streamclip, I can export to the same specs but in FCE it still makes me re-render the clips for some reason. very time consuming...

Maybe you are looking for