title: Return value in a class from another class and method
body: <p>Note that I am new with Java. I have a class and and a method in this class hat computes some values and I want to return them in the first class. I have a code but it returns 0.</p>
  
  <p>That's in class that computes the values</p>
  
  <pre><code>public class ImageProcessing{
  int i,j;
  int R[][]=new int[640][320];
  int G[][]=new int[640][320];
  int B[][]=new int[640][320];
  
  
  public double meanR[]=new double[320];
  public double meanG[]=new double[320];
  public double meanB[]=new double[320];
  public double varianceR[]=new double[320];
  public double varianceG[]=new double[320];
  public double varianceB[]=new double[320];
  public double skewnessR[]=new double[320];
  public double skewnessG[]=new double[320];
  public double skewnessB[]=new double[320];
  
  public double round(double value){
      //  int decimalPlace = 2;
  
      BigDecimal bd = new BigDecimal(value);
      bd = bd.setScale(2,BigDecimal.ROUND_UP);
      return (bd.doubleValue());
  }
  
  public void Mean(Bitmap image){
  
      int width = image.getWidth();
      int height = image.getHeight();
      int pixel = 0;
  
  
      for (i=0; i&lt;width;i++){
          for (j=0; j&lt;height; j++){
              pixel = image.getPixel(i,j);
              R[i][j] = Color.red(pixel);
              G[i][j]= Color.green(pixel);
              B[i][j] = Color.blue(pixel);
  
  
              meanR[j]=meanR[j]+R[i][j];
              meanG[j]=meanG[j]+G[i][j];
              meanB[j]=meanB[j]+B[i][j];
          }
      }
  </code></pre>
  
  <p>In the main class I have:</p>
  
  <pre><code>    method.Mean(rescaledBitmap1);
  
      meanR1=method.meanR;
      meanG1=method.meanG;
      meanB1=method.meanB;
      System.out.println(meanR1);
  </code></pre>