Use of Pattern provide stranges results

I want to match if a character is in a string definition (ie strchr in C (ex: strchr ("01234567809",number[0]) or strchr ("YN",answer))
see code below:
Pattern p;
Matcher m;
p=Pattern.compile("\\d");
m=p.matcher("123");
System.out.println("m1="+m.find());
System.out.println("m2="+Pattern.matches("\\d","123"));
I use this code from java example help a the result is :
m1=true
m2=false
any help appreciated
frederic
ps:I work with eclipse

The matches method checks to see if the string matches the pattern EXACTLY. Here, the pattern is "one digit", and the string is three digits. Hence, the pattern doesn't match the string.
If you want to check to see if there is any digit in the string, add a .* in front of and after the \\d. This will say "anything at all (or nothing) followed by a digit followed by anything at all (or nothing)". This is really the behavior you want.
The regex you want is ".*\\d.*".
- Adam

Similar Messages

  • Strange Results keying out Green Screen Using Keylight

    Hi,
    I'm keying out a green screen using keylight. When I look at the view "Status" in keylight I notice a strange result that I can't seem to resolve. Inside the solid area of the matte (the actor) his pants and shoes area are filled with tiny light green dots. They seem to be causing distortion on my final render.
    No matter what adjustments I make to the matte I can't seem to get rid of these. I've attached a few small GIFs to show the issue.
    Is there anyway to remove these dots so they are "solid" within the matte or a way to color correct them inside the solid area of the matte in the final result?
    Any advise would be greatly appreciated.
    Regards,

    That's what the Despot options in the Screen Matte section are for. Alternative options include Minimax, Simple Chocker or third-party plug-ins like Re:Fill from RevisionFX. Also make good use of the various rollback options to control your Alpha levels.
    Mylenium

  • BEx Query Providing Incorrect Results

    I have two BEx queries that are behaving strangely.
    They are providing incorrect results and I can't figure out why.
    In both cases, when I save query in development under a different technical name the problem disappear.   I can't use this as a permanent solution because users insert queries in workbooks and we have portal links.
    Is there a way to somehow  fix these queries that
    are acting strangely.
    Query 1:
    When run query get error message
    "No roll storage space of length 120 available fro OCCURS area"
    Query2:   Calculates Wrong Average
    When run query:
    Adding Cumulative Qty Customer Balance + Quantity Customer Movement
    together.
    Set Aggregation to Average
    ref char Posting Period.
    The avearge BEx calculates only considers  Cummulative Quantity
    End Customer Balance.  It should consider consider Quantity Customer Movement as well.
    Avg formula :  ((Jan End - (.5* Jan Mov) ) + (Feb End - (.5* Feb Mov))+   (Mar End -(.5* March Mov)))/3
    I have used the same  methodology to calculate average with other queries and it average calculates correctly.  These other queries have same InfoProvider and using the same dimensions as queries that are calculating average incorrectly.

    Hi Mti
    Thank you for your reply.
    I have checked the details as per your suggestion:
    1. KF Aggreagtion tab on Workbench Exception Aggregation is on SUM Summation.
    2. RKF on The Query is on (Nothing Defined).
    Is there anything else that can be checked?
    Thank you

  • Strange results with Insert statement having select query

    Hi all,
    I am facing a strange issue with Insert statement based on a select query having multiple joins.
    DB- Oracle 10g
    Following is the layout of my query -
    Insert into Table X
    Select distinct Col1, Col2, Col3, Col4, Function(Col 5) from Table A, B
    where trunc(updated_date) > = trunc(sysdate-3)
    and join conditions for A, B
    Union
    Select Col1, Col2, Col3, Col4, Function(Col 5) from Table C, D
    trunc(updated_date) > = trunc(sysdate-3)
    and join conditions for C, D
    Union
    .... till 4 unions. all tables are residing in the local Database and not having records more than 50,000.
    If I execute above insert in a DBMS job, it results into suppose 50 records where as if I execute the select query it gives 56 records.
    We observed following things-
    a) no issue with size of tablespace
    b) no error while inserting
    c) since query takes lot of time so we have not used Cursor and PLSQL block for inserting.
    d) this discrepancy in number of records happens frequently but not everytime.
    e) examined the records left out from the insert, there we couldn't find any specific pattern.
    f) there is no constraint on the table X in which we are trying to insert. Also tables A, B, C....
    I went through this thread -SQL insert with select statement having strange results but mainly users are having either DB Links or comparison of literal dates, in my case there is none.
    Can somebody explain why is the discrepancy and what is the solution for it.
    Or atleast some pointers how to proceed with the analysis.
    Edited by: Pramod Verma on Mar 5, 2013 4:59 AM
    Updated query and added more details

    >
    Since I am using Trunc() in the where clause so timing should not matter much. Also I manually ruled out records which were updated after the job run.
    >
    The first rule of troubleshooting is to not let your personal opinion get in the way of finding out what is wrong.
    Actually this code, and the process it represents, is the most likely CAUSE of the problem.
    >
    where trunc(updated_date) > = trunc(sysdate-3)
    >
    You CANNOT reliably use columns like UPDATED_DATE to select records for processing. Your process is flawed.
    The value of that column is NOT the date/time that the data was actually committed; it is the date/time that the row was populated.
    If you insert a row into a table right now, using SYSDATE (8am on 3/5/2013) and don't commit that row until April your process will NEVER see that 3/5/2013 date until April.
    Here is the more typical scenario that I see all the time.
    1. Data is inserted/updated all day long on 3/4/2013.
    2. A column, for example UPDATED_DATE is given a value of SYSDATE (3/4/2013) in a query or by a trigger on the table.
    3. The insert/update query takes place at 11:55 PM - so the SYSDATE values are for THE DAY THE QUERY BEGAN
    4. The data pull begins at 12:05 am (on 3/5/2013 - just after midnight)
    5. The transaction is COMMITTED at 12:10 AM (on 3/5/2013); 5 minutes after the data pull began.
    That data extract in step 4 will NEVER see those records! They DO NOT EXIST when the data pull query is executed since they haven't been committed.
    Even worse, the next nights data pull will not see them either! That is because the next pull will pull data for 3/5/2013 but those records have a date of 3/4/2013. They will never get processed.
    >
    Job timing is 4am and 10pm EST
    >
    Another wrinkle is when data is inserted/updated from different timezones and the UPDATED_DATE value is from the CLIENT pc or server. Then you can get even more data missed since the client dates may be hours different than the server date used for the data pull process.
    DO NOT try to use UPDATED_DATE type columns to do delta extraction or you can have this issue.

  • Help - count function returns strange results

    hi everyone,
    here's my scenario: i'm trying to get the NUMBER OF REPORTS and NUMBER OF
    IMAGES GROUP BY MONTH from the two tables below.
    REPORT
    reportid(*primary key)
    date
    IMAGE
    reportid(*foreign key referring to report's table)
    image
    sample output:
    MONTH NO.OF REPORTS NO. OF IMAGES
    feb 01 10 9
    mar 01 12 8
    my SQL goes like this:
    select to_char(date, 'month-yy'),
    count(REPORT.reportid), count(IMAGE.reportid)
    from REPORT, IMAGE
    where REPORT.reportid = IMAGE.reportid
    group by to_char(date, 'month-yy')
    the above sql yielded strange results, number of images is equal to the number of reports, which is of course wrong! as one report may or may not contain one or more image.
    i dont know what's wrong with the above statement, but if i were to group it
    by REPORTID and DAY rather than MONTH, then amazingly it works! what's
    wrong with the count, why does it give me the same result if i group by
    MONTH.
    can anyone shed some light on this?

    try using the following example:
    Table TEST_REPORT
    RPTID RPTDATE
    1 02-JAN-01
    3 02-JAN-01
    2 02-JAN-01
    5 11-FEB-01
    6 11-FEB-01
    7 11-FEB-01
    Table TEST_IMAGE
    RPTID IM
    1 1
    2 1
    3 1
    SQL:
    select to_char(rptdate,'MON-YYYY'),
    sum(decode(a.rptid,null,0,1)) report_cnt,
    sum(decode(b.rptid,null,0,1)) image_cnt
    from test_report a, test_image b
    where a.rptid = b.rptid(+)
    group by to_char(rptdate,'MON-YYYY');
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by skcedric:
    hi everyone,
    here's my scenario: i'm trying to get the NUMBER OF REPORTS and NUMBER OF
    IMAGES GROUP BY MONTH from the two tables below.
    REPORT
    reportid(*primary key)
    date
    IMAGE
    reportid(*foreign key referring to report's table)
    image
    sample output:
    MONTH NO.OF REPORTS NO. OF IMAGES
    feb 01 10 9
    mar 01 12 8
    my SQL goes like this:
    select to_char(date, 'month-yy'),
    count(REPORT.reportid), count(IMAGE.reportid)
    from REPORT, IMAGE
    where REPORT.reportid = IMAGE.reportid
    group by to_char(date, 'month-yy')
    the above sql yielded strange results, number of images is equal to the number of reports, which is of course wrong! as one report may or may not contain one or more image.
    i dont know what's wrong with the above statement, but if i were to group it
    by REPORTID and DAY rather than MONTH, then amazingly it works! what's
    wrong with the count, why does it give me the same result if i group by
    MONTH.
    can anyone shed some light on this? <HR></BLOCKQUOTE>
    null

  • Asynchronous read & write by using Asynchronous api provided in nio-java 7

    HI,
    I am trying to write a small program to implement **asynchronous read & write by using Asynchronous api provided in nio in java 1.7** in windows machine.
    i tried the following code to write a small string to a file asynchronously.file is getting created but the contents are not dispalying.
         static long startTime = System.currentTimeMillis();
         static long endTime;
         static long execTime;
         public static void main(String[] args) {
              String path = "C:\\AsynchWrite.txt";
              Path file = Paths.get(path);
              final AsynchronousFileChannel channel;
              long pos = 1;
              try {
                   OpenOption[] options = { StandardOpenOption.CREATE,
                             StandardOpenOption.WRITE, StandardOpenOption.SYNC };
                   channel = AsynchronousFileChannel.open(file, options);
                   ByteBuffer buffer = ByteBuffer.allocate(1000);
                   String writeThis = "Testing by writing a line";
                   byte[] src = writeThis.getBytes();
                   buffer.put(src);
                   channel.write(buffer, pos, null,
                             new CompletionHandler<Integer, Object>() {
                                  @Override
                                  public void completed(Integer result, Object attachment) {
                                       System.out.println("completed successfully");
                                       System.out.println("start time :" + startTime);
                                       endTime = System.currentTimeMillis();
                                       System.out.println("end time : " + endTime);
                                       execTime = endTime - startTime;
                                       System.out.println("Execution Time :" + execTime);
                                       System.out.println("Execution Time(ms) :"
                                                 + execTime);
                                       try {
                                            channel.force(true);
                                            channel.close();
                                       } catch (IOException e) {
                                            // TODO Auto-generated catch block
                                            e.printStackTrace();
                                  @Override
                                  public void failed(Throwable exc, Object attachment) {
                                       // TODO Auto-generated method stub
                                       System.out.println("failed!!");
              } catch (IOException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
         }Please help me out
    Thanks in advance,
    Ravi

    It looks like you are missing buffer.flip() after your put as otherwise the buffer position will be at 25 (not 0 as you expect).

  • How to use CQL patterns in CEP?

    Hi,
    How to use CQL patterns and what is the use ?

    Try the new Stream Explorer interface and check out the patterns section. These are pre-defined patterns that allow you to look for trends, missing events, duplicates, W Pattern, etc. These do in-memory incremental processing of data with high throughput and low latency.
    The SX user interface allows you to easily define a data stream and start applying a pattern. An Event Processing Network (EPN) with a CQL processor and the CQL are generated automatically and the results are immediately shown on the user-interface.

  • Strange result about regular expressions

    Hello everybody,
    I write these codes to try regular expressions in Java, but there are some strang results. I read the reference like Sun Java Tutorials. however, I cann't find the problem.
    Environnement:
    WindowsXP Home + NetBeans IDE 5.0 + JDK 1.5
    Input String:
    "I write these codes to try regular expressions in Java, but it doesn't work. I read some reference like Sun Java Tutorials. Then, always cann't find the problem. Could you help me? Thanks."
    My codes:
    public static void main(String[] args) throws Exception, IOException {
    P.rintln("Let's go!");
    Date start = new Date();
    if(args.length != 1) {
    P.rintln("Input Error! Input format: java javaclass [directory path]");
    System.exit(0);
    StringBuffer sb = new StringBuffer();
    String input = TextFile.read(args[0]);
    sb = addSectionEelement(input, "re");
    P.rintln(sb.toString());
    P.rintln("Ok, it's over");
    Date end = new Date();
    System.out.println("It spends " + (end.getTime() - start.getTime()) + " ms.");
    public static StringBuffer addSectionEelement(String input, String regex) {
    Matcher m = Pattern.compile(regex).matcher(input);
    StringBuffer sb = new StringBuffer();
    int count = 0;
    while(m.find()) {
    count++;
    P.rintln(m.group());
    P.rintln("Found " + count + " fois.");
    return sb;
    Output:
    run:
    Let's go!
    Found 0 fois.
    Ok, it's over
    It spends 16 ms.
    BUILD SUCCESSFUL (total time: 0 seconds)
    However if I change the Bold line by
    sb = addSectionEelement(input, "r");
    The resultats become:
    run:
    Let's go!
    r
    r
    r
    r
    r
    r
    r
    r
    r
    r
    r
    Found 11 fois.
    Ok, it's over
    It spends 15 ms.
    BUILD SUCCESSFUL (total time: 0 seconds)
    I have no idea about it. And you?
    Thanks

    Hi guys,
    I re-examine the codes. In fact, it's the problem of encodings of the input file.
    See u

  • Strange results

    Hi guys,
    Sorry to ask such a simple question but I can't seem to work out why Im get strange results when I do the following:
    double t = 1564654654 / 1000000000;
           System.out.println(t);The result I get is 1.0 but I should get 1.564654654
    Any help would be great
    Many thanks
    Alex

    When you divide an int by an int, you get an int. Then you assign the int value to a double.
    Either use the cast as posted previously, or use a decimal point with one of the numbers (which will cause Java to handle it as a double.)

  • To generate sine curve using sine pattern.vi

    I tried to generate sine wave to provide sine curve to the motor. I used sine pattern.vi and the vi located before the while loop. I could not put it inside 'while loop' to change the amplitude of the sine curve while the program runs. What do I have to make some changes in the program to provide different values in 'sine pattern.vi' while the program runs?
    Attachments:
    AO_command_sin_input_with_position_info.vi ‏165 KB

    Jae,
    Looking at your VI, it seems that what you want to do is update the sinewave generated on the fly. Try using the Point by Point functions to generate a sinewave, they will give your the most flexibility. I am attaching an example that generates a sinewave point by point. If you change the value of the frequency control, you will see that the frequency of the waveform will change on the fly.
    Attachments:
    Generate_Sinewave_PtByPt.vi ‏32 KB

  • Strange result for outer join with rownum

    I'm using rownum in join condition of left outer join query but i'm getting strange results.
    Query is:
    Select * from table1 left outer join table2 on table1.id = table2.id or rownum=1
    Data in table1 is
    id
    7
    8
    9
    Data in table2 is
    id
    10
    11
    12
    Result of above query in Oracle 9.2.0.1 is
    table1.id table2.id
    7 10
    7 11
    7 12
    8 10
    8 11
    8 12
    9 10
    9 11
    9 12
    Even if change is rownum related condition to like rownum >2 even than i'm getting same result.
    In case of inner join, the above condition gives results as required.
    Can anybody explain the result or is it a bug?

    could you please explain why you are using rownum.
    You may have a look at the following link explaining rownum and you should understand why you got this result, keep in mind that you are using an OR condition.
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/sql_elements6a.htm#4295

  • Problem while using color pattern matching

    Currently we are doing projects on real time object tracking where we found one doubt that irrespective of the object size whether this color pattern match works or not . My questions are as follows:
    1. Whether it is applicable for objects moving far . Because as it moves far, the size of the object decreases such that the color pattern matching is not working what will be solution since we must use color image
    2. What is the difference in using scale and  rotate invarient in color pattern matching
    3. How we can effectively decrease the ROI depending upon the object position as per below attached screen shots .
    we have removed boundary box values of X and Y coordinates at the four corner but we can't track as the object moves far away or we can't decrease the ROI as the object moves far.
    4. whether it is possible to see the value of particular pixel  in LABVIEW vision development module as we seen only the coordinate position . whether it is applicable to see particular pixel value. Guide us
    please, see the below screen shots and provide the solution how effectively decrease or increase  the ROI depending on objects position using color pattern match
    Attachments:
    problem in matching while object moves far.png ‏515 KB

    Hello,
    I have not been using the color pattern matching a lot (especially not in real-time). But since the pattern matching considers only small scale changes, you could try updating the color template every n-th iteration (depending on your setup and requirements). The major problem is the template size, since the color pattern matching tends to take quite a lot of time in learning the template. You would of course need to come up with some idea on how to change the subimage size, where the new template will be learned.
    This is the part of coarse (rough) object detection as was suggested by MoviJOHN. For example, if your object is distinctly red, you can extract the green channel from your rgb image and use threshold to roughly find the object and apply the new ROI - template.
    So:
    1. learn the template,
    2. use pattern matching with bounding rectangle (ROI) for the next couple of frames (you would need to experiment here where the detection fails -> how fast can you move the object away so that the detection fails),
    3. Before the detection fails -> rough object detection with some padded bounding rectangle (new ROI),
    4. Re-learn te template of new ROI and go back to 2.
    Again, the biggest issue is the template learning time - if you have a high resolution camera and the template is large, this won't satisfy your real-time application.
    You should set up the appropriate illumination first. The resolution is also important, since your object is moved back and forth (but the resolution will have a direct impact on the template learning time).
    Best regards,
    K
    https://decibel.ni.com/content/blogs/kl3m3n
    "Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."

  • Strange results when receiving mail sent form mail.app

    Hi all,
    I've searched these forums for an answer to this problem but I didn't find anything that seemed to fit the bill.
    I'm using the latest version of mail.app 2 with updates applied running in 10.4.3.
    I'm using Gmail as my mail server but have the same problem with other email servers I have tried.
    When I send mail to my work account (based on an exchange server) I'm getting some strange results. I'm using Windows 2000 and Outlook 2003 at work.
    When I send an (new) email with an attachment then all text that I write below the attachment in the email, when received through exchange at work, becomes an attachment its self. If this is a plain text email then the attachment is a text file, if it's a rich text email then the attachment becomes a webdocument (HTM). This is not the desired result!
    Similarly, if I reply to or forward an email, any text below new text I type into those emails becomes an attachment rather than an actual reply (with that attachment either a text file or a webdocument as stated above).
    My question therefore is how can this be corrected. It's rather annoying to have half my message cut off if I put an attachment half way through the email I am composing (I guess i could attach it to the end below all text and signature). Equally frustrating is having replied or forwarded text appear in an attachment.
    Thanks in anticipation.
    Adam
    Powerbook 12"   Mac OS X (10.4.3)  

    Hi all,
    Picture of what I describe above, thought it might help clarify what the issue is:
    Many thanks
    Adam
    Powerbook 12"   Mac OS X (10.4.3)  
    Message was edited by: adamsquire

  • Why do I have lines when I use the pattern tool ? is it an illustrator bug ? When I register it in .pdf or .jpg the line disappear ?

    Hello,
    When I use the pattern tool via the window which is here : object / patter / create --> and I choose in the mosaic style by brick columns I have this result : http://bit.ly/1nozEl3
    I don't understand why do I have those lines ? thanks for helping.

    Hello Jacob,
    Thanks for responding.
    Yes, it's seems to be a screen artifact, when I zoom they seem to move or disappear but they're still here.
    With SVG, it's the same.
    When I untick Anti-aliased Artwork, the artifact disappear, but my designs change, no more precision ! Have a look here :  http://bit.ly/UyGoVe
    Any other solution ?
    Thanks

  • STRANGER RESULT

    Hi, the code below maps some objects to a key and then buts that key in to a linked list. When I compile and run this program I get a strange result can you help me please(note that more code is involved)
    public class Subsets {
         //Vector v = new Vector();
         Properties ht = new Properties();
         LinkedList ll = new LinkedList();
         ArrayList al1, al2, al3, al4, al5, al6, al7, al8;
         String           key = null;
         String           key2;
         int          intKey;
         //Card          cd[];
    ArrayList newArr = null;
         //Card vectArray[];
         //Card cd1[], cd2[], cd3[], cd4[], cd5[], cd6[], cd7[], cd8[];
    public ArrayList permutations(Hand dk, Hand comp){
         for (int f=0; f < dk.getCardCount(); f++){
              key = String.valueOf(dk.getCard(f).getValue());
              al1 = new ArrayList();
              al1.add(dk.getCard(f));
              ll.add(ht.put(key,al1));
              for (int s=f+1; s < dk.getCardCount(); s++){
                   key = String.valueOf(dk.getCard(f).getValue()+dk.getCard(s).getValue());
                   al2 = new ArrayList();
                   al2.add(dk.getCard(f));
                   al2.add(dk.getCard(s));
                   ll.add(ht.put(key, al2));
                   //v.addElement(ht.put(key,cd2));
                   for (int t=s+1; t < dk.getCardCount(); t++){
                        key = String.valueOf(dk.getCard(f).getValue()+dk.getCard(s).getValue()+dk.getCard(t).getValue());
                        al3 = new ArrayList();
                        al3.add(dk.getCard(f));
                        al3.add(dk.getCard(s));
                        al3.add(dk.getCard(t));
                        ll.add(ht.put(key,al3));
                        //v.addElement(ht.put(key,cd3));
                        for (int a=t+1; a < dk.getCardCount(); a++){
                             key = String.valueOf(dk.getCard(f).getValue()+dk.getCard(s).getValue()+dk.getCard(t).getValue()+dk.getCard(a).getValue());
                             al4 = new ArrayList();
                             al4.add(dk.getCard(f));
                             al4.add(dk.getCard(s));
                             al4.add(dk.getCard(t));
                             al4.add(dk.getCard(a));
                             ll.add(ht.put(key,al4));
                             //v.addElement(ht.put(key,cd4));
                             for (int b=a+1; b < dk.getCardCount(); b++){
                                  key = String.valueOf(dk.getCard(f).getValue()+dk.getCard(s).getValue()+dk.getCard(t).getValue()+dk.getCard(a).getValue()+dk.getCard(b).getValue());
                                  al5 = new ArrayList();
                                  al5.add(dk.getCard(f));
                                  al5.add(dk.getCard(s));
                                  al5.add(dk.getCard(t));
                                  al5.add(dk.getCard(a));
                                  al5.add(dk.getCard(b));
                                  ll.add(ht.put(key,al5));
                                  //v.addElement(ht.put(key,cd5));
                                  for (int c=b+1; c < dk.getCardCount(); c++){
                                       key = String.valueOf(dk.getCard(f).getValue()+dk.getCard(s).getValue()+dk.getCard(t).getValue()+dk.getCard(a).getValue()+dk.getCard(b).getValue()+dk.getCard(c).getValue());
                                       al6 = new ArrayList();
                                       al6.add(dk.getCard(f));
                                       al6.add(dk.getCard(s));
                                       al6.add(dk.getCard(t));
                                       al6.add(dk.getCard(a));
                                       al6.add(dk.getCard(b));
                                       al6.add(dk.getCard(c));
                                       ll.add(ht.put(key,al6));
                                       //v.addElement(ht.put(key,cd6));
                                       for (int d=c+1; d < dk.getCardCount(); d++){
                                            key = String.valueOf(dk.getCard(f).getValue()+dk.getCard(s).getValue()+dk.getCard(t).getValue()+dk.getCard(a).getValue()+dk.getCard(b).getValue()+dk.getCard(c).getValue()+dk.getCard(d).getValue());
                                            al7 = new ArrayList();
                                            al7.add(dk.getCard(f));
                                            al7.add(dk.getCard(s));
                                            al7.add(dk.getCard(t));
                                            al7.add(dk.getCard(a));
                                            al7.add(dk.getCard(b));
                                            al7.add(dk.getCard(c));
                                            al7.add(dk.getCard(d));
                                            ll.add(ht.put(key,al7));
                                            //v.addElement(ht.put(key,cd7));
                                            for (int e=d+1; e < dk.getCardCount(); e++){
                                                 key = String.valueOf(dk.getCard(f).getValue()+dk.getCard(s).getValue()+dk.getCard(t).getValue()+dk.getCard(a).getValue()+dk.getCard(b).getValue()+dk.getCard(c).getValue()+dk.getCard(d).getValue()+dk.getCard(e).getValue());
                                                 al8 = new ArrayList();
                                                 al8.add(dk.getCard(f));
                                                 al8.add(dk.getCard(s));
                                                 al8.add(dk.getCard(t));
                                                 al8.add(dk.getCard(a));
                                                 al8.add(dk.getCard(b));
                                                 al8.add(dk.getCard(c));
                                                 al8.add(dk.getCard(d));
                                                 al8.add(dk.getCard(e));
                                                 ll.add(ht.put(key,al8));
                                                 //v.addElement(ht.put(key,cd8));
         Iterator itr = ll.iterator();
         first:{
              while(itr.hasNext()){     
    // key2 = String.valueOf(itr.next());
    //System.out.println("key2 : "+key2);
    System.out.println("size "+ll.size());
    System.out.println("next "+itr.next());
    // intKey = Integer.parseInt(key2);
                   //for(int j=comp.getCardCount()-1; j>=0;j++){
                   //     if(intKey == comp.getCard(j).getValue()){
                   //          newArr = (ArrayList)ht.get(key2);
                   //          break first;
              if(!itr.hasNext()){
                   newArr = null;
    newArr = (ArrayList)ht.get(key2);
         return newArr;
    the result that I get is as follows
    Cards on the table are:
    0. 6 of Hearts
    1. 7 of Hearts
    2. 4 of Spades
    3. Jack of Spades
    4. 7 of Spades
    Its r's turn
    size 31
    next null
    size 31
    next null
    size 31
    next null
    size 31
    next null
    size 31
    next null
    size 31
    next null
    size 31
    next null
    size 31
    next null
    size 31
    next null
    size 31
    next null
    size 31
    next null
    size 31
    next [6 of Hearts, 7 of Hearts, 4 of Spades, Jack of Spades]
    size 31
    next [6 of Hearts, 7 of Hearts, 4 of Spades]
    size 31
    next null
    size 31
    next [6 of Hearts, 7 of Hearts, Jack of Spades]
    size 31
    next [6 of Hearts, 7 of Hearts]
    size 31
    next null
    size 31
    next null
    size 31
    next null
    size 31
    next null
    size 31
    next [6 of Hearts, 4 of Spades, Jack of Spades]
    size 31
    next null
    size 31
    next null
    size 31
    next [6 of Hearts, Jack of Spades]
    size 31
    next null
    size 31
    next null
    size 31
    next [7 of Hearts, 4 of Spades, Jack of Spades]
    size 31
    next [7 of Hearts, 4 of Spades]
    size 31
    next null
    size 31
    next [7 of Hearts, Jack of Spades]
    size 31
    next [7 of Hearts]
    Exception in thread "main" java.lang.NullPointerException
    at java.util.Hashtable.get(Hashtable.java:320)
    at Subsets.permutations(Subsets.java:124)
    at PlayScopa.computerTurn(PlayScopa.java:273)
    at PlayScopa.scopaPlay(PlayScopa.java:133)
    at PlayScopa.scopaStart(PlayScopa.java:89)
    at MainApp.main(MainApp.java:29)
    [u9zuh /home/stud3/csc99/u9zuh]$
    why are there gaps here
    not the for loops are as follows
    for(){
    ......for(){
    .............for(){
    .....................etc.....

    It's telling you exactly where the problem is:
    Exception in thread "main" java.lang.NullPointerException
    at java.util.Hashtable.get(Hashtable.java:320)
    at Subsets.permutations(Subsets.java:124)
    at PlayScopa.computerTurn(PlayScopa.java:273)
    at PlayScopa.scopaPlay(PlayScopa.java:133)
    at PlayScopa.scopaStart(PlayScopa.java:89)
    at MainApp.main(MainApp.java:29)
    What code is at line 124 of Subsets?
    When you figure out what line that is (use your IDE - Control-G often lets you type in a line number) look at the variables used on that line and see which one(s) hasn't been assigned a value.

Maybe you are looking for

  • My iPhone is no longer downloading mail messages

    I have both my work e-mail and Gmail on my iPhone.  For some reason, my work e-mails are no longer automatically being pushed to my phone unless I click on the Mail icon and wait for it to connect/download.  This isn't the case for my Gmail...and my

  • Goods Issue to sales order

    Hi Experts, When doing Goods issue to sales order using movement type 231, I am getting the following warning message 'Sales order (SOBKZ = ) is not provided for this goods movement'. I think this warning is due to difference in special stock indicat

  • SOAP response to file

    Hello, i am working on scenario as given below. JDBC to SOAP synchronous. So once i got the response i need to save as file (XML format). please let me know the stpes to capture the SOAP response payload from SXMB_MONI and save as XML file. Thanks in

  • Does the ME3400 switch support MDI/MDI-x autocross

    Does the ME3400 switch support MDI/MDI-x autocross? I recently experienced  a situation where when the switch was set to a fixed 100 Full duplex and the outboard device selected the wrong pair, they would never link. Is MDI/MDI-x only supported on au

  • Mouse but no keyboard on my mini 10.4.8

    hi guys ive recently bought an apple bluetooth mouse and keyboard direct from apple to use with my mini mac. The mini I have has no bluetooth internally so i have bought a belkin usb jobbie. The mouse and my mobile connects just fine and works like a