There is no reason to store a value that is never read. Doing so indicates a bug: was the value assigned to the wrong variable? Was some calculation left out of the method? If it is not a bug, it is a waste of cycles and an obfuscation of the code. 


== Noncompliant Code Example

----
public int getNumber(int a) {
  int i; 
  int b = a;

  for (i = 0; i < 10; i++) {
    b *= i;
  }

  i = a;  // Noncompliant; value assigned but not used before return

  return b;  
}
----


== Compliant Solution

----
public int getNumber(int a) {
  int i; 
  int b = a;

  for (i = 0; i < 10; i++) {
    b *= i;
  }

  return b;  
}
----

