According to Rom. 9, it is obvious that God chooses who will be saved. So the question is, how is that just? Very simply, justice is people getting what they deserve. Sinners deserve lake of fire judgment, according to many statements in scripture, both old and new testaments. If God chose not to save any man, He would still be just, because everyone deserves lake of fire judgment, regardless of how religious they try to make themselves. Self-righteousness does not merit salvation.
But Rom. 9 clearly says that God has mercy on whom He desires, and by the very nature of the statement means that He has mercy on some, not all. And mercy is not part of justice, nor does it have anything to do with justice, except to circumvent it. Mercy is an exception to justice. So God is not obligated in any way to have mercy on everyone, just because He decided to have mercy on some.
Therefore, your question that if God choses some for salvation and some to be passed over, how is that just - is a question that lacks understanding. Now you're the one who must define justice according to how you are using the word. Justice does not require mercy on anyone, much less on everyone, just because mercy is given to another. But God has the right to do whatever He wants with His own creation.
Rom. 3:10-18 clearly states why God is not obligated to save anyone. But in fact He does save some, as Paul argues in the rest of Romans (and 1 Cor. 1&2 and Eph. 2). First accept what God says about Himself and His choices (even if you don't understand it), then you will be in a better attitude to later understand what it means.