I opt for the solution that the term ἄνθροπος used two times in v. 25 in both cases indicate the Lord Jesus Christ Himself.
Let me explain:
The previous 24th verse says that "He did not entrust Himself to those who believed in Him for He knew all". This is a claim of Christ's divinity, for only God - neither arch-arch-angel, nor satan, nor any most perspicacious man who ever has lived or will live on earth or other planet - can know what is in the mind and heart of man, and in this immediate concrete context, Christ does not entrust Himself even to those who, apparently, acknowledge His supra-natural abilities. Why is Christ dissatisfied then even by those acknowledgers?
It is simple: because just like in John 6:26, He discerned that they did not acknowledge the inner cause and meaning of the miracle-working, to wit, that the one who acts miracles out of His sovereign authority, without prayers, is God, but their sole concern was only the effect of a miracle: healing, getting satiated etc.: "You have not come to Me because you have seen a miracle, but because you have eaten and got satiated" (Jon 6:26). Thus, unlike the Samaritan woman who (after seeing that Jesus miraculously knew her life's facts without knowing - speaking in a humanly dimension - her, in fact, seeing her first time) cared about issues of salvation and theology (John ch.4), those Jews in John 2:24 and 6:26 cared about and coveted for earthly things, even when praising the Lord's miraculous deeds. Thus, unlike the Samaritan woman who through seeing a miracle, used this seeing as a trigger for elevating herself above the earthly things and even above this very miracle to apprehension of heavenly, theological realities, the Jews saw in the miracles of the Lord an opportunity to lay hold of earthly things with an even greater greed, and they would desire to make Jesus a King, just for guaranteeing for themselves those earthly, transient values, being idolaters in the core of their hearts and to the marrow of their bones. And the Lord Jesus Christ knew their hearts, therefore did not entrust Himself to those woe praisers and admirers.
Now, in ἄνθρωπος of the verse 25 He implies Himself, for the grammar of the sentence is so more plausible, for the word is with a definite article, indicating, thus, not general human kind, but rather a concrete man, here, the Lord himself. But what does it mean? I think, in the light of what was said above, the phrase "He knew what was in the man", that is to say, "He knew what was in Himself", means that He knew that the divine authority was in Himself, and He needed not any man to acknowledge this authority, for Father's acknowledgment and testimony was enough for Him, and this testimony was that He worked the deeds of the Father, i.e. the miracles, out of His own authority, which was identical to the authority of the Father, for as Their deeds are one (John 5:17), so is Their authority. That's why also elsewhere He says that He does not need to receive testimony from men (John 5:34), but it is enough for Him to testify about Himself and simultaneously be testified by the Father (John 8:18).
Thus, yes, the ἄνθρωπος must be the Lord Jesus Christ Himself. However, other interpretations and translations that a general "man" is implied here, or all human hearts, is also theologically (less so grammatically) plausible, because already in a previous verse it is a clear statement of divinity of Christ through proclamation of His ability to know the inner intent of human hearts.
To say in passing: John 2:24-25 are a verses of frightening warning, dismantling our hearts' nasty propensity to utilize the Lord for our earthly aims, and not, as it is due, to love Him so as to start hating those very earthly aims, for love of the earthly aims is hatred towards Christ (cf. James 4:4), but we want a tamed Christ, false Christ, an idol-Christ who is complacent to our earthly attachments and whims.