Sum of first N Star Numbers | Java program to find the sum of the first N star numbers ; Function to find the sum of the first N star number ; Variable to store the sum ; Driver code
class GFG { static int sum_star_num ( int n ) { int summ = 2 * n * ( n + 1 ) * ( n - 1 ) + n ; return summ ; } public static void main ( String [ ] args ) { int n = 3 ; System . out . println ( sum_star_num ( n ) ) ; } }