Hi all,

I've been doing JAVA for some time, and as a practice I'm making a Blackjack program, which calculates my probabilities of winning and equality given a certain shoe (number of cards).

Ultimately I would like to have a program which gives me my probabilities of winning the following hand given a certain shoe.
(forget about doubling, splitting etc., even forget about equality, let's assume we play a game where when winning you double your bet, and losing or equality you loose your bet).

Imagine I would have 30% chance of winning my next hand, how would I have to calculate how much I have to bet to be winning on the long term?
Knowing of course one time I have 30% chance of winning, the following hand 50% chance of winning, the following hand 70% chance of winning, the next one again 25% of winning).
What comes into the calculations to know how much I would have to bet?

In other words, how do Card Counters know how much to bet each hand?
I suppose I would have to be able to calculate a % of my bankroll to bet, given a certain probability to win?
What comes into account for this calculation? The number of hands played, the amount in your bankroll?

Maybe it's way more simple than I'm imagining, maybe it's way more complicated.
I'm just trying to find out how the logic works behind betting and winning in long run, with the advantage I can calculate for every hand my chances of winning (and therefore as well my chances of loosing).