title: In Java, does validating user input with a while loop take a lot of processing time/resources
body: <p>So while editing my question (multiple attempts) I finally found the correct search terms for my original question (see below - I was missing the try-catch part).</p>
  
  <p>Answers I was searching for:
  <a href="https://stackoverflow.com/questions/16451777/is-it-expensive-to-use-try-catch-blocks-even-if-an-exception-is-never-thrown">Is it expensive to use try-catch blocks even if an exception is never thrown?</a> and/or <a href="https://stackoverflow.com/questions/36343209/which-part-of-throwing-an-exception-is-expensive?noredirect=1&amp;lq=1">Which part of throwing an Exception is expensive?</a></p>
  
  <p>Edited original question: 
  Thanks for the responses everyone, but I can see from the comments that I wasn't clear enough in my question. Sorry about that. Let me hopefully clarify:</p>
  
  <p>I'm new to Java and want to make sure I don't start off forming a bad habit. In Python, I like to validate all user input as early as I can. I often use while loops to do this; however, my projects have been small.</p>
  
  <p><a href="https://stackoverflow.com/questions/24857070/try-catch-inside-while-loop">Try-Catch inside While Loop</a>, or many other websites, have examples of while loops that validate a user's input in Java. However, these are also very small code examples.</p>
  
  <p><strong>My question is:</strong>
  Does validating the user's input this way take a lot of processing time/resources? Not just one; but if ALL user inputs were validated this way in a large scale Java project? </p>
  
  <p>The reason I ask is because I worked somewhere in the past (that used Java) where all of the user input wasn't validated. Since I was in quality assurance and support I saw a lot of problems result from this. I'm trying to think of why you wouldn't always use a while loop to validate user input.</p>
  
  <p>Marking as duplicate: Instead of deleting this, I looked at several posts about closing your own question on Meta Stack Exchange. Many of the solutions presented didn't seem to be available for me (probably b/c of lack of privileges). But, I followed the info at: <a href="https://meta.stackexchange.com/questions/79916/is-it-possible-to-mark-my-own-question-as-duplicate-of-another">https://meta.stackexchange.com/questions/79916/is-it-possible-to-mark-my-own-question-as-duplicate-of-another</a> - comment - "Close" doesn't appear for me 2011-08-25, but "Flag" did and has a flow to provide an exact duplicate link. – Vincent Scheib Aug 25 '11 at 16:36 - and this worked for me as well.</p>