MCPcopy Create free account
hub / github.com/Syncleus/aparapi / getFactors

Method getFactors

src/main/java/com/aparapi/Range.java:130–141  ·  view source on GitHub ↗

Determine the set of factors for a given value. @param _value The value we wish to factorize. @param _max an upper bound on the value that can be chosen @return and array of factors of _value

(int _value, int _max)

Source from the content-addressed store, hash-verified

128 */
129
130 private static int[] getFactors(int _value, int _max) {
131 final int factors[] = new int[MAX_GROUP_SIZE];
132 int factorIdx = 0;
133
134 for (int possibleFactor = 1; possibleFactor <= _max; possibleFactor++) {
135 if ((_value % possibleFactor) == 0) {
136 factors[factorIdx++] = possibleFactor;
137 }
138 }
139
140 return (Arrays.copyOf(factors, factorIdx));
141 }
142
143 /**
144 * Create a one dimensional range <code>0.._globalWidth</code> with an undefined group size.

Callers 3

createMethod · 0.95
create2DMethod · 0.95
create3DMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected