Driver code
public static void main ( String [ ] args ) { int arr [ ] = { 1 , 0 , 1 , 0 , 1 , 1 } ; int n = arr . length ; int pre [ ] = new int [ n ] ; precompute ( arr , n , pre ) ; System . out . println ( decimalOfSubarr ( arr , 2 , 4 , n , pre ) ) ; System . out . println ( decimalOfSubarr ( arr , 4 , 5 , n , pre ) ) ; } }