You can use Item::getMaxStackSize(). If an item can not be stacked, the returned max stack size will be 1.