title: How can I make my long methods shorter in Java?
body: <p>I am beginner in Java and my problem is that my methods often gets very long. I have been told that methods should be as short as possible and one method should only be doing one thing. For example I have made a program where you can auction on dogs. I need tips on how I can break out smaller methods out of this long one but still get it to work the same way. Here is my code:</p>
  
  <pre><code>private void makeNewBid() {
  
  System.out.println("Enter the name of the user&gt;");
  String userName = input.nextLine().toLowerCase();
  User u = getUser(userName);
  if (userName == null || !userRegister.contains(u)) {
      System.out.println("error. no such user");
      return;
  
  
  }else {
  
  
  Auction bidAuction = null;
  String name = dogLowerCaseTrim();
  Dog d = getDog(name);
  for(Auction a: auctionRegister ) {
      if(auctionRegister.equals(name.toLowerCase())) {
          bidAuction = a;
          break;
      }
  }
  Auction a = getAuctionedDog(d);
  if(bidAuction != null) {
      System.out.println("error. this dog is not up for auction.");
  
      return;
  }
  
  System.out.print("Amount to bid: min " + (getAuctionedDog(d).getTopBid()+ 1 )+ "&gt; ");
  int amount = input.nextInt();   
  while(amount &lt;= a.getTopBid()) {
      System.out.println("error. too low bid");
      System.out.println("Amount to bid: min " + (getAuctionedDog(d).getTopBid() + 1));
      amount = input.nextInt();
  
  
  }
  Bid b = new Bid(u, amount);
  getAuctionedDog(d).addBid(b);
  System.out.println("Bid made");
  input.nextLine();
  
  }    
  
  }
  </code></pre>