Question: This is in Java being run through Eclipse. /** * Creates an array of all the powers of two, up to (and including) * the
This is in Java being run through Eclipse.
/** * Creates an array of all the powers of two, up to (and including) * the given exponent starting at 2^0. * * If the given exponent is less than zero, return an empty array. * You can do this by saying "return new int[0];" * * For example: * powersOfTwo(3) returns {1,2,4,8} * powersOfTwo(0) returns {1} * powersOfTwo(-66) returns {} * * Requires: arrays, for loops */
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
