Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Nov 2003
    Posts
    13

    Please help me! Strange behavior...

    I don't know if this is the right place to ask for this... but hey guys here are experts in java

    i have an array like this one:

    public static int[] nivel1 = {
    0,0,0,0,0,0,0,0,0,0,
    0,0,1,1,1,1,1,1,0,0,
    0,0,0,1,1,1,1,0,0,0,
    0,0,1,1,0,0,1,1,0,0};

    why does nivel1.length gets me the value 14???

    if we count the 1 values we get 14 and i tried to change the number of 1's in the array and the length keeps guessing the number of 1's... what i needed was the total length of 0's and 1's

    How can i do that and why length does this??

    Regards

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395
    Good question... when I try it, it gives me 40.

    Perhaps you could post a complete (minimal!) example?

    Graham.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×