Results 1 to 3 of 3
  1. #1
    udayjava is offline Member
    Join Date
    Feb 2012
    Posts
    2
    Rep Power
    0

    Default How to update rows in 2 D arrays?

    I have a two dimensional array which has the initial set of data and then I have an ArrayList of Integers which has some of the rows of the two dimensional arrays .And the indexes of the rows which were copied from the two dimensional array are stored in another ArrayList. The new set of ArrayList of Integers was modified and now I want to update these rows in the original 2 D array.

    This is the code I used :

    Java Code:
     static void update_new_pop(int [][]new_pop, ArrayList<int[]> crossover_population, ArrayList<Integer> crossover_pop_index,int pop_size,int size_crossover_pop_index,int m){  
             for(int iterRow = 0,j=0;iterRow<pop_size;iterRow++)  
             {  
                 if(j<size_crossover_pop_index){  
                       
                   
                 if(iterRow == crossover_pop_index.get(j)){  
                    new_pop[iterRow]=crossover_population.get(j);  
                    j++;  
                 }  
                 }  
             }  
             for(int iterRow = 0;iterRow<pop_size;iterRow++){  
                 System.out.println("array["+iterRow+"]:");  
                 for(int iterCol=0;iterCol<m;iterCol++){  
                     System.out.print(+new_pop[iterRow][iterCol]);  
                 }  
                 System.out.println();  
             }  
               
         }

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,390
    Rep Power
    25

    Default Re: How to update rows in 2 D arrays?

    You don't say if you have a problem or what the problem is.
    Can you explain?

    You need to define several variables that are used in the code you posted if you want anyone to make sense of it.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,234
    Rep Power
    19

    Default Re: How to update rows in 2 D arrays?

    udayjava, you should continue the discussion in the thread you started yesterday rather than post a new, obviously related question. Or did you plan to clutter the forum with threads you never return to? That's not going to happen.

    I'm closing this thread.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Jtable rows
    By riddhishah28 in forum AWT / Swing
    Replies: 3
    Last Post: 02-18-2011, 06:24 AM
  2. jxl repeating rows
    By mermaid in forum New To Java
    Replies: 0
    Last Post: 01-14-2011, 03:59 PM
  3. Arrays.sort... why sorting all arrays in class?
    By innspiron in forum New To Java
    Replies: 6
    Last Post: 03-23-2010, 01:40 AM
  4. Replies: 2
    Last Post: 03-16-2010, 08:24 PM
  5. How to get the no. of rows in a resultset
    By baskar.nitt in forum New To Java
    Replies: 5
    Last Post: 09-19-2008, 01:30 PM

Posting Permissions

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