Finding all the prime factors of a number
Quick observation: you use Math.pow() to calculate powers of two. This is highly inefficient, use bit shifting to prevent long -> double conversion

For example, 2^10 can be calculated very quicky as 1 &lt;&lt; 10. See for example here (https://stackoverflow.com/q/141525/461499) 

Also you divide a double by a long and then convert to long (in effect flooring), you can skip conversion to double entirely to speed things up.