Q:

How to put output data into my tab[]?

Here's my sample code:   
(...)   for (int i = 0; i < counting.total(); i++) {

        CvPoint3D32f circle = new CvPoint3D32f(cvGetSeqElem(couting, i));
        CvPoint middle = cvPointFrom32f(new CvPoint2D32f(circle.x(), circle.y()));
        int radious = Math.round(circle.z()) 

   }              (...)

circle.x and circle.y gives me the parameters that I need for my calculation. For example when i put it into:            
 System.out.println(circle.x() +" " +circle.y());

It will give me an output (depending on how many circle I got):
 48 91 (x1,y1)
 43 31 (x2,y2)
 41 43 (x3,y3)

etc.
My question is: How can I tell my program that for example I want to calculate x1 + x3 ?
I guess I need to put my output into array but I dont know how :(

A:

use a 2d array
int xy[][]=new int[counting.total()][2];

and add to it inside loop
xy[i][0]=circle.x();
xy[i][1]=circle.y();

if you want to calculate x1+x3
then take value.don't forget arrays are zero index based
              1st[row] 3rd[row]
              ↓        ↓
 int total=xy[0][0]+xy[2][0];
                ↑         ↑
               1st[col]   1st[col]

example code.but use variables for counting.total() to avoid repeating
int xy[][]=new int[counting.total()][2];

for (int i = 0; i < counting.total(); i++) {

        CvPoint3D32f circle = new CvPoint3D32f(cvGetSeqElem(couting, i));
        CvPoint middle = cvPointFrom32f(new CvPoint2D32f(circle.x(), circle.y()));
        int radious = Math.round(circle.z()) 
        xy[i][0]=circle.x();
        xy[i][1]=circle.y();    
}      

int total=xy[0][0]+xy[2][0];// x1+x3 =[row 1][col 1]+[row 3][col 2] // since arrays are zero index based ,row 1-->x[0] vice visa ...

