Area of the Largest Triangle inscribed in a Hexagon | Java Program to find the biggest triangle which can be inscribed within the hexagon ; Function to find the area of the triangle ; side cannot be negative ; area of the triangle ; Driver code
import java . io . * ; class GFG { static double trianglearea ( double a ) { if ( a < 0 ) return - 1 ; double area = ( 3 * Math . sqrt ( 3 ) * Math . pow ( a , 2 ) ) / 4 ; return area ; } public static void main ( String [ ] args ) { double a = 6 ; System . out . println ( trianglearea ( a ) ) ; } }