fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main(String[] args){
  11. int[] yourArray = new int[]{10, 18, -12, 4, 8, -3, -5, 67, 9, 14};
  12. int depth = 4;
  13. System.out.println(Arrays.toString(new Ideone().a(yourArray, depth)));
  14. }
  15.  
  16. int[]a(int[]a,int b){if(b<1)return a;int e=a.length-1,c[]=new int[e],i=e;for(;i-->0;)c[i]=a[i+1]-a[i];return a(c,b-1);}
  17. }
Success #stdin #stdout 0.1s 320320KB
stdin
Standard input is empty
stdout
[-142, 55, 27, 41, -269, 397]