Take , n=5 (say) and see what values j assumes. You will find that , j assumes values like 1,3,6 for k=1,2,3 , thus j assumes values like k(k+1)/2. Now the for loop runs for k times , and j=k(k+1)/2, so equating with n on RHS , k^2=n or k=sqrt(n). So for loop runs sqrt(n) times.
Outer while is of the form [where i=n]
while(i>0){
i=i/2
} and so complexity is log n. Hence for each of these log n times the for runs sqrt(n) times , complexity=O(logn*sqrt(n)).