public static int fibBuffer[] = new int [1000]; 
public static int fibBottomUp(int n) 
{ 
   fibBuffer[0] = 0; 
   fibBuffer[1] = 1; 

   int index=2; 
   while (index<=n) 
   { 
      fibBuffer[index] = fibBuffer[index-2] + fibBuffer[index-1]; 
      index++; 
   } 
   return fibBuffer[n]; 
} 
