I've copied the following method from page 173 of this book.
public class ThreeSum
{
public static int count(int[] a)
{ // Count triples that sum to 0.
int N = a.length;
int cnt = 0;
for (int i = 0; i < N; i++)
for (int j = i+1; j < N; j++)
for (int k = j+1; k < N; k++)
if (a[i] + a[j] + a[k] == 0)
cnt++;
return cnt;
}
public static void main(String[] args)
{
int[] a = In.readInts(args[0]); // error here
StdOut.println(count(a)); // and here
}
}
The In.readInts
causes an error. Do I need to be including a library to access the 'In' object? (third last line)