## Adobe Interview Question

Interns**Country:**India

**Interview Type:**Written Test

```
public static int roundOff(int[] arr)
{
int number = getSum(arr);
return nextHighestPower(number);
}
private static int nextHighestPower(int number)
{
if ((number & number - 1) == 0)
{
return number;
}
else
{
int count = 0;
while (number != 0)
{
number = number >> 1;
count++;
}
return 1 << count;
}
}
public static int getSum(int[] arr)
{
int sum =0;
foreach (int i in arr)
{
sum +=i;
}
return sum;
}
```

is it like each element must be rounded to the next power or the sum of all elements? I assume each element:

- Chris November 29, 2017