0

I am trying to sum up each arraylist within an arraylist. I am assuming you use the get method. but I am not sure how to do this exactly. This is what I have so far. As indicated by the arrows is were I am trying to add up the arraylist before it starts on the new arraylist. Any ideas?????

    public void sparseCountTimer(ArrayList arraylist)
    {
        double totalRowsCount = 0.0;
        long   totalTime      = 0;

        for (int x = 0; x < iteration; x++)
        {
            long   startTime2     = 0,
                   estimatedTime2 = 0;
            double rowTotal       = 0.0,
                   lastRowTotal   = 0.0;

            for( int i = 0; i < matrixDimension; ++i)
            {
                if (lastRowTotal < rowTotal)
                {
                    lastRowTotal = rowTotal;
                    startTime2 = System.nanoTime(); 
                }
                rowTotal = 0.0;
                for (int j = 0; j < matrixDimension; ++j)
                {
            >>>>>>>>>    rowTotal += arraylist.get(j).get(i);    <<<<<<<<<<<<<<
                }
                estimatedTime2 = System.nanoTime() - startTime2;
            }
            totalRowsCount += lastRowTotal;
            totalTime += estimatedTime2;
        }
    }
dana
  • 17,267
  • 6
  • 64
  • 88
  • You may want to look at this question regarding multi-dimensional arrays in C#. An `ArrayList` by default only has 1 dimension. http://stackoverflow.com/questions/597720/what-is-differences-between-multidimensional-array-and-array-of-arrays-in-c – dana Jul 10 '13 at 22:58
  • ok so arraylist.get something to that effect still not sure any ideas. – Chaz Carraway Jul 11 '13 at 00:12

0 Answers0