title: Changing an array value in Java method without passing it to method
body: <p>I want to create a function to change a value in an array, but I don't want to pass the array to the function. Here is the part of the code, <code>data[] array</code> created at another function.</p>
  
  <pre><code>private int[] data;
  
  public static void main(String[] args) {
      setPixel(3,2); //I'm not sure at this part?
  }
  
  public void setPixel(int i,int x){ 
      data[i] = x; //Is there any possible way to change data[]  
  }
  </code></pre>