First of all, a bit of theory: since the area of a square is given by
![A = s^2](https://img.qammunity.org/2019/formulas/mathematics/middle-school/thwajl8nsw13oh3jl1iznf7u07fryox7xu.png)
where s is the length of the square. So, if we invert this function we have
.
Moreover, the diagonal of a square cuts the square in two isosceles right triangles, whose legs are the sides, so the diagonal is the hypothenuse and it can be found by
![d = √(s^2+s^2) = √(2s^2) = s√(2)](https://img.qammunity.org/2019/formulas/mathematics/high-school/j64w2fa76kqfu75xs2v8jnr2hexuzto9o0.png)
So, the diagonal is the side length, multiplied by the square root of 2.
With that being said, your function could be something like this:
double diagonalFromArea(double area) {
double side = Math.sqrt(area);
double diagonal = side * Math.sqrt(2);
return diagonal;
}