Largest hexagon that can be inscribed within a square | Java Program to find the biggest hexagon which can be inscribed within the given square ; Function to return the side of the hexagon ; Side cannot be negative ; Side of the hexagon ; Driver code
import java . io . * ; class GFG { static double hexagonside ( double a ) { if ( a < 0 ) return - 1 ; double x = ( 0.5176 * a ) ; return x ; } public static void main ( String [ ] args ) { double a = 6 ; System . out . println ( hexagonside ( a ) ) ; } }