if (a != 1 && solone == (int)solone && soltwo == (int)soltwo){
// (lx+o)(mx+p)
int h = (a*c);
List<Integer> factors = new ArrayList<Integer>();
for (int i = 1; i < Math.sqrt(h); i++) {
if (h % i == 0)
factors.add(i);
}
Integer result = null;
for (int ii: factors) {
if (b == ii + h/ii){
result = ii;
// ax^2+hiix+iix+c
}
int hii = h/ii;
int gcd1 = Euclid.getGcd(a, hii);
int gcd2 = Euclid.getGcd(ii, c);
String Factored = FactoredForm.getFF(gcd1, gcd2, a, hii);
}
My String called Factored is one I need to use for printing later in my code. I can’t use it because it doesn’t recognize the variable outside of the for loop. How do I go about making it public? When i added public in front of the string, it said that only final is permitted? Also, I cannot simply move the extraneous code outside of the for loop because it all depends on the integer “ii” which is part of the loop. Help!
Do you really want this to be part of the state of an instance of the class? If so, declare it outside the method:
I would advise you not to make it public. If you need to expose the value, do so via a property.
Think carefully about whether it really is logically part of the state of this class though. Also revisit naming conventions, as mentioned before.