The code that you provided is in C++. You need to migrate it to Java. For instance, remove the main function. Is not needed as Processing provides one for you under the hood. Also you need to replace;
cout<<"Class 1 : "<<numInClass[0]<<"\n";
for
println("Class 1 : ",numInClass[0],"\n");
You might need to fix some other lines.
Kf