Is it bad to masturbate?

What does the Bible say about masturbating? What are your thoughts about it? Is it bad?