Find length of Diagonal of Hexagon | Java Program to find the diagonal of the hexagon ; Function to find the diagonal of the hexagon ; side cannot be negative ; diagonal of the hexagon ; Driver code
import java . io . * ; class GFG { static float hexadiagonal ( float a ) { if ( a < 0 ) return - 1 ; return 2 * a ; } public static void main ( String [ ] args ) { float a = 4 ; System . out . print ( hexadiagonal ( a ) ) ; } }