Driver program
public static void main ( String argv [ ] ) { int a [ ] = { 1 , 1 , 2 , 1 , 3 , 4 , 5 , 2 , 8 } ; int n = a . length ; ArrayList < Query > q = new ArrayList < Query > ( ) ; q . add ( new Query ( 0 , 4 ) ) ; q . add ( new Query ( 1 , 3 ) ) ; q . add ( new Query ( 2 , 4 ) ) ; int m = q . size ( ) ; printQuerySums ( a , n , q , m ) ; } }