Loot tables

Anyone have any sample code or pseudo-code on how to implement these (nicely?) in Java.

I currently roll a rand(10) that feeds a 10 case switch statement to test stuff, but now I need concept of rarity…

I’ve googled a bit but found nothing that resembled a lookup table structure (which is what I thought loot-tables were supposed to be based on??)