```
class Solution {
public int[] constructRectangle(int area) {
int sqrt =(int)Math.floor(Math.sqrt(area));
while(area%sqrt!=0){
sqrt--;
}
int[] ans = {area/sqrt,sqrt};
return ans;
}
}
```

The difference in length and breadth would be smallest for sqrt, but if the area is not a perfect square we try the nearest number smaller than the sqrt, that would divide the area.