Sum of series 1 ^ 2 + 3 ^ 2 + 5 ^ 2 + . . . + ( 2 * n | Java Program to find sum of series 1 ^ 2 + 3 ^ 2 + 5 ^ 2 + . . . + ( 2 * n - 1 ) ^ 2. ; Function to find sum of series . ; Formula to find sum of series . ; Driver function
import java . io . * ; import java . util . * ; class GFG { static int sumOfSeries ( int n ) { return ( n * ( 2 * n - 1 ) * ( 2 * n + 1 ) ) / 3 ; } public static void main ( String [ ] args ) { int n = 10 ; System . out . println ( sumOfSeries ( n ) ) ; } }