This is one of the most basic rules of life. What you input influences what the output is. If you input certain instructions into a computer game, the output is that the game does what you've told it to. If you input values into a process, it follows the process and spits out the relevant value. If you plant a certain type of seed, that's what grows.
It's easy to forget that this rule, which applies to just about any other area of life, also applies to us as people. If you input junk, you output junk. It says in the Bible (if I can remember where I put it down last...) "Whatever is true, whatever is noble, whatever is right, whatever is pure, whatever is lovely, whatever is admirable--if anything is excellent or praiseworthy--think about such things" (Phillipians 4v8). This is basically saying that you ought to think about nice stuff. And if you think about nice stuff, then you'll act nice. I know that oversimplifies a bit, but the cause effect relationship is there. It certainly works the opposite way around. A relationship has been found between listening to music with sexual lyrics and having sex at a younger age.
It's not so easy to think about nice things--true, noble, excellent, admirable things--in today's world. But I doubt it was much easier in the world of the Bible. Okay, they didn't have twenty-four seven tv, internet and music. But they did have a lot more contact between individuals, and there was slavery and stuff which was pretty blatant. It can sometimes seem that the only way to avoid listening to rubbish is to stick your head in the sand and ignore the world. But Jesus didn't do that. He wasn't afraid to go out there into the big bad world, the real world, talking to real people who society hated. However, if you look around, there is plenty to see that's true and honourable. Lukas posted about the Isaiah Project, there's plenty of stuff like that. If you make the effort, there are plenty of books and films out there which aren't encouraging people to leap into bed with each other. I'm not saying it's easy. But it's worth doing it. What sort of seeds are you sowing into your life? And what sort of crop do you want to reap?