# Expectation of a uniform given a value

I'm trying to check wheter my math is in order with my intuition:

Let say i have a random variable $Z \sim Uniform(0,1)$:

If i want to compute: $E[Z \mid Z < a]$ whereas "$E$" is expectation and $0<a<1$:

My intuition tells me that this expectation would be $\frac{a}{2}$ and the math behind is:

Using Bayes theorem i should get an expression for $f(Z=z \mid Z < a)$ (density function):

So later i can write: $E[Z \mid Z < a] = \int_{0}^{a} z f(Z=z \mid Z < a) dz$

So, in order to get $\frac{a}{2}$ as a result from the integral, the only choice is to have $f(Z=z \mid Z < a) = \frac{1}{a}$ but i can't get to this.

Note that, for any number $z \leq a$
$$P(Z < z \mid Z < a) = \frac{ P(Z < z \text{ and } Z < a) }{P(Z < a)} = \frac{ P(Z < z) }{P(Z < a)} = \frac{z}{a}$$
$$F_{Z \mid (Z < a)}(z) = \frac{z}{a}$$