Sum total of in-battle enemies and active battlers formula

Hello, this is my first post on these forums! I've been fiddling around with RMMV for a bit and would like to implement a custom HUD. Now I have a problem getting a specific element of the HUD to only show up at specific totals of enemies and actors using $gameTroop.members()[0] and $gameParty.members()[0]. How do you write the formula to add two variables together to make a specific total?

$gameTroop.members()[] + $gameParty.members()[] = 4

obviously doesn't work (I have absolutely no knowledge of Java)
Can someone help me on my way here?
Thought I had it figured out. Thanks for the replies, I'll try your solutions!
I'm not sure exactly what you're trying to do with it, but you could try to use $gameTroop.members().length and $gameParty.members().length
$gameTroop.members() returns an array. To get how many elements are in that array, you can use the "length" property of arrays.

(by the way, MV uses Javascript, not Java)

Edit: ninja'd

Original thread: https://forums.rpgmakerweb.com/threads/sum-total-of-in-battle-enemies-and-active-battlers-formula.102825/