# MLE for special uniform case [duplicate]

I'm preparing for my exam and I came across this question:

Let $$X_1, X_2, ...,X_n$$ be iid with PDF $$f(x)=\frac{2x}{\theta^2}$$ for $$0 \leq x \leq \theta.$$ Find the MLE of $$\theta$$

So this is what I did:

$$L(\theta)= \prod\frac{2x_i}{\theta^2}I(0 \leq x \leq \theta)$$

$$= (2n \bar{x})(\frac{1}{\theta^{2n}})I(0 \leq min (x_i)\leq max(x_i) \leq \theta)$$

$$=(2n \bar{x})(\frac{1}{\theta^{2n}})I(0 \leq X_{(1)}\leq X_{(n)} \leq \theta)$$

In order to find MLE, I need to maximize $$L(\theta)$$, by choosing a small $$\theta$$. However, $$\theta$$ can't be smaller than $$X_n$$. Thus I conclude that:

$$\hat{\theta}= max(x_i)$$

Is my calculation and conclusion correct?