Question: Write a java method that accepts an integer as parameter and returns a string as an expression of the sum of powers of 2 in

Write a java method that accepts an integer as parameter and returns a string as an expression of the sum of powers of 2 in increasing order. (Non-duplicate)

Sample Input: 20 Sample Output: 20 = 4+16

Sample Input: 2021 Sample Output: 2021 = 1+4+32+64+128+256+512+1024

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!