fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. import java.math.* ;
  8.  
  9. /* Name of the class has to be "Main" only if the class is public. */
  10. class Ideone
  11. {
  12. public static void main (String[] args) throws java.lang.Exception
  13. {
  14.  
  15. List< BigInteger > inputs =
  16. List.of(
  17. new BigInteger( "3" ) ,
  18. new BigInteger( "7" ) ,
  19. new BigInteger( "10" ) ,
  20. new BigInteger( "2" )
  21. ) ;
  22.  
  23. Optional< BigInteger > result =
  24. inputs
  25. .stream()
  26. .reduce( BigInteger :: multiply )
  27. ;
  28.  
  29. System.out.println( result ) ;
  30.  
  31. }
  32. }
Success #stdin #stdout 0.1s 48936KB
stdin
Standard input is empty
stdout
Optional[420]