Largest square that can be inscribed within a hexagon which is inscribed within an equilateral triangle | Java program to find the side of the largest square that can be inscribed within the hexagon which in return is incsribed within an equilateral triangle ; Function to find the side of the square ; Side cannot be negative ; side of the square ; Driver code
class cfg { static float squareSide ( float a ) { if ( a < 0 ) return - 1 ; float x = ( 0.423f * a ) ; return x ; } public static void main ( String [ ] args ) { float a = 8 ; System . out . println ( squareSide ( a ) ) ; } }