This is frankly as basic a question as it gets, and google could have helped you with this easily. Here’s your entire method if you want to design your own.
public static int getCount(ArrayList A){
return A.size();
}
solved How do I use on method to get the sizes of two different-sized arrayslists?