int i=0;

                        for (i=0; i<msg.length;i++){

                            switch (i){

                                  case 0:

                                  case 1:

                                  case 2:

                                  case 3:

                                  case 4:

                                  case 5:

                                  case 6:

                                  case 7:

                                  case 8:

                                  case 9:

                                  case 10:

                                  case 11:

                                  case 18:

                                  case 19:

                                  case 26:

                                  case 27:

                                  case 34:

                                  case 35:

                                  case 42:

                                  case 43:

                                  case 50:

                                  case 51:

                                  case 52:

                                  case 53:

                                  case 54:

                                  case 55:

                                  case 58:

                                  case 59:

                                  case 62:

                                  case 63: log.debug("******** TRAZA-BEA: autenticacion ntlm. mensaje[" + i + "]: " + msg[i] + " SINSIGNO: " + (int)(msg[i] & 0x00ff) + "   " + new String(msg,i,1, "UTF-16LE")); break;

                                  case 12:

                                  case 14:

                                  case 16:

                                  case 20:

                                  case 22:

                                  case 24:

                                  case 28:

                                  case 30:

                                  case 32:

                                  case 36:

                                  case 38:

                                  case 40:

                                  case 44:

                                  case 46:

                                  case 48:

                                  case 56:

                                  case 60:log.debug("******** TRAZA-BEA: autenticacion ntlm. mensaje[" + i + "]: " + msg[i] + " SINSIGNO: " + (int)(msg[i] & 0x00ff) + "   " + new String(msg,i,2, "UTF-16LE")); break;

                                  case 13:

                                  case 15:

                                  case 17:

                                  case 21:

                                  case 23:

                                  case 25:

                                  case 29:

                                  case 31:

                                  case 33:

                                  case 37:

                                  case 39:

                                  case 41:

                                  case 45:

                                  case 47:

                                  case 49:

                                  case 57:

Why not case 60? LOL

By Pabs, 2017-12-26 14:03:33
try{
    //...
    getMyDataFromServer();
    //...
}catch(Excepion e){
    // :D
}

HMM FIXED BUG!

By H20, 2017-12-23 11:12:50
@Override
public void afterTextChanged(Editable s) {
    switch (paymentType) {
        case 0:
            if (s.length() == 9) etPaymentAmount.requestFocus();
            break;
        case 1:
            if (s.length() == 9) etPaymentAmount.requestFocus();
            break;
    }
}
By Anonymous, 2017-12-22 12:41:02
private static final double RESULT_OF_DIVISION_BY_0 = 9.99;

public static double getPercentageDifference(long currentResult, long previousResult) {
    if (previousResult == 0 && currentResult == 0) {
        return 0;
    } else if (previousResult == 0) {
        return RESULT_OF_DIVISION_BY_0;
    } else {
        return (currentResult - previousResult) * 1.0 / previousResult;
    }
}
By Anonymous, 2017-12-20 10:56:50
                    //read country intformation and assign to variables
                    cName = InpList.get(0).replace(",", ".");
                    cCode = InpList.get(1).replace(",", ".");
                    cAlpha2 = InpList.get(2).replace(",", ".");
                    cAbreviation = InpList.get(3).replace(",", ".");
                    dYear = InpList.get(4).replace(",", ".");
                    dPoliticalCompatibility = InpList.get(5).replace(",", ".");
                    dRankPoliticalCompatibility = InpList.get(6).replace(",", ".");
                    dEconomicCompatibility = InpList.get(7).replace(",", ".");
                    dRankEconomicCompatibility = InpList.get(8).replace(",", ".");
                    dMilitaryCompatibility = InpList.get(9).replace(",", ".");
                    dRankMilitaryCompatibility = InpList.get(10).replace(",", ".");
                    dDemoScore = InpList.get(11).replace(",", ".");
                    dRankDemoScore = InpList.get(12).replace(",", ".");
                    dEnvironmentalCompatibility = InpList.get(13).replace(",", ".");
                    dRankEnvironmentalCompatibility = InpList.get(14).replace(",", ".");
                    dSumCompatibility = InpList.get(15).replace(",", ".");
                    dRankCompatibility = InpList.get(16).replace(",", ".");
                    dPoliticalUtility = InpList.get(17).replace(",", ".");
                    dRankPoliticalUtility = InpList.get(18).replace(",", ".");
                    dEconomicUtility = InpList.get(19).replace(",", ".");
                    dRankEconomicUtility = InpList.get(20).replace(",", ".");
                    dMilitaryUtility = InpList.get(21).replace(",", ".");
                    dRankMilitaryUtility = InpList.get(22).replace(",", ".");
                    dEnvironmentalUtility = InpList.get(23).replace(",", ".");
                    dRankEnvironmentalUtility = InpList.get(24).replace(",", ".");
                    dSumUtility = InpList.get(25).replace(",", ".");
                    dRankUtility = InpList.get(26).replace(",", ".");
                    dPoliticalScore = InpList.get(27).replace(",", ".");
                    dRankPoliticalScore = InpList.get(28).replace(",", ".");
                    dEconomicScore = InpList.get(29).replace(",", ".");
                    dRankEconomicScore = InpList.get(30).replace(",", ".");
                    dMilitaryScore = InpList.get(31).replace(",", ".");
                    dRankMilitaryScore = InpList.get(32).replace(",", ".");
                    dEnvironmentalScore = InpList.get(33).replace(",", ".");
                    dRankEnvironmentalScore = InpList.get(34).replace(",", ".");
                    dAggregate = InpList.get(35).replace(",", ".");
                    dRankAggregate = InpList.get(36).replace(",", ".");
By Anonymous, 2017-12-17 21:45:26
if (logger.isDebugEnabled()) {
			logger.debug("process (FollettPojo) - start");	
		}
String dnum = StringUtil.toCapitalizedString(pojo.getDnum().toString()); 
pojo.setDnum(new String(dnum));
	    
if (logger.isDebugEnabled()) {
    logger.debug("process (FollettPojo) - middle ");
}

String rawI = StringUtil.toCapitalizedString(pojo.getRawInput().trim().toString()); 
pojo.setRawInput(new String(rawI));

if (logger.isDebugEnabled()) {
	logger.debug("process (FollettPojo) - end ");
}
		
		
/* And you may ask what is this toCapitalizedString? Well here you go a separate class to boot */
	public static String toCapitalizedString(String string){
		StringBuilder strb = new StringBuilder();
		if(string != null && string.trim().length() > 0
				&& Character.isLetter(string.charAt(0))
				&& Character.isLowerCase(string.charAt(0))){

			strb.append(string.substring(0,1).toUpperCase()).append(string.substring(1));
			return strb.toString();
		}
		return string;

	}

SpringBatch this is the processor for each record...dnum example D00000000

By Albert, 2017-12-15 23:53:41
public static int[] xxx(String filename) throws IOException{
	int[] f = new int[26];
	BufferedReader in = new BufferedReader(new FileReader(filename));
	String line;
	while((line = in.readLine()) != null){
		line = line.toUpperCase();
		for(char ch:line.toCharArray()){
			if(Character.isLetter(ch)){
				f[ch - 'A']++;
			}
		}
	}
	in.close();
	return f;
}
By Anonymous, 2017-12-15 16:08:38
private <T> Supplier<T> abort(Class<T> exception) {
  return () -> {
    try {
      return exception.newInstance();
    } catch (InstantiationException | IllegalAccessException e) {
      throw new RuntimeException(e);
    }
  };
}

...

throw abort(MyException.class).get();
By Anonymous, 2017-12-14 11:27:50
int phoneNumberFinder(int phoneNum){
int num = 0;
   while (true){
    if(phoneNum == num){
     return num;
    else{
      num++;
    }
  }
}
By Neeson, 2017-12-13 21:33:52
  /** 
   * Deserializes the contents of the incoming message buffer {@code b}. 
   * 
   * @return deserialised object
   * @throws UnsupportedEncodingException If the named charset is not supported
   */
  Object r() throws UnsupportedEncodingException{
    int i=0, n, t=b[j++];
    if(t<0)
      switch(t){
        case -1:
          return rb();
        case (-2):
          return rg();
        case -4:
          return b[j++];
        case -5:
          return rh();
        case -6:
          return ri();
        case -7:
          return rj();
        case -8:
          return re();
        case -9:
          return rf();
        case -10:
          return rc();
        case -11:
          return rs();
        case -12:
          return rp();
        case -13:
          return rm();
        case -14:
          return rd();
        case -15:
          return rz();
        case -16:
          return rn();
        case -17:
          return ru();
        case -18:
          return rv();
        case -19:
          return rt();
      }
    if(t>99){
      if(t==100){
        rs();
        return r();
      }
      if(t<104)
        return b[j++]==0&&t==101?null:"func";
      if(t>105)
        r();
      else
        for(n=ri();i<n;i++)
          r();
      return "func";
    }
    if(t==99)
      return new Dict(r(),r());
    j++;
    if(t==98)
      return new Flip((Dict)r());
    n=ri();
    switch(t){
      case 0:
        Object[] L=new Object[n];
        for(;i<n;i++)
          L[i]=r();
        return L;
      case 1:
        boolean[] B=new boolean[n];
        for(;i<n;i++)
          B[i]=rb();
        return B;
      case 2: {
        UUID[] G=new UUID[n];
        for(;i<n;i++)
          G[i]=rg();
        return G;
      }
      case 4:
        byte[] G=new byte[n];
        for(;i<n;i++)
          G[i]=b[j++];
        return G;
      case 5:
        short[] H=new short[n];
        for(;i<n;i++)
          H[i]=rh();
        return H;
      case 6:
        int[] I=new int[n];
        for(;i<n;i++)
          I[i]=ri();
        return I;
      case 7:
        long[] J=new long[n];
        for(;i<n;i++)
          J[i]=rj();
        return J;
      case 8:
        float[] E=new float[n];
        for(;i<n;i++)
          E[i]=re();
        return E;
      case 9:
        double[] F=new double[n];
        for(;i<n;i++)
          F[i]=rf();
        return F;
      case 10:
        char[] C=new String(b,j,n,encoding).toCharArray();
        j+=n;
        return C;
      case 11:
        String[] S=new String[n];
        for(;i<n;i++)
          S[i]=rs();
        return S;
      case 12:
        Timestamp[] P=new Timestamp[n];
        for(;i<n;i++)
          P[i]=rp();
        return P;
      case 13:
        Month[] M=new Month[n];
        for(;i<n;i++)
          M[i]=rm();
        return M;
      case 14:
        Date[] D=new Date[n];
        for(;i<n;i++)
          D[i]=rd();
        return D;
      case 15:
        java.util.Date[] Z=new java.util.Date[n];
        for(;i<n;i++)
          Z[i]=rz();
        return Z;
      case 16:
        Timespan[] N=new Timespan[n];
        for(;i<n;i++)
          N[i]=rn();
        return N;
      case 17:
        Minute[] U=new Minute[n];
        for(;i<n;i++)
          U[i]=ru();
        return U;
      case 18:
        Second[] V=new Second[n];
        for(;i<n;i++)
          V[i]=rv();
        return V;
      case 19:
        Time[] T=new Time[n];
        for(;i<n;i++)
          T[i]=rt();
        return T;
    }
    return null;
  }

Manually maintained open-source code on GitHub. Looks like decompiled from obfuscated binary, they just reformatted it, added some comments and now are making manual changes. Current version: https://github.com/KxSystems/javakdb/blob/master/src/kx/c.java Original version: https://github.com/KxSystems/javakdb/blob/c9afe6fa32d7d3e3cddabdc9bd43f0155a5d2a1b/src/kx/c.java

By KxSystems, 2017-12-13 17:19:57
public static returnTrue(boolean b){
    if (b){
        return true;
    } else {
        return true;
    }
}

When you want your function always returns the correct value

By kayvan goli, 2017-12-13 14:49:39
boolean darkModeSelected = (!darkModeSelected ? true : false);
By Anonymous, 2017-12-13 09:40:59
outerloop:
try {
    if (selectedFile == null) {
        break outerloop;
    } else {
        if (selectedFile != null) {
            readTo = new PrintStream(selectedFile);
            readTo.println(userCodeInput.getText());
            readTo = readTheOptionsIntegers(readTo);
    }
} catch(IOException e) {
    System.out.println(e);
}
By Anonymous, 2017-12-13 09:39:37
int number = -1;
                //todo: refactor this horse shit.
                for (String res: results) {
                    if(number == -1){
                        if(res.toLowerCase().contains("ten") || res.contains("10") || res.contains("10") || res.contains("十") || res.contains("십")){
                            number = 10;
                        }
                        else if(res.toLowerCase().contains("nine") || res.contains("9") || res.contains("9") || res.contains("九") || res.contains("구")){
                            number = 9;
                        }
                        else if(res.toLowerCase().contains("eight") || res.contains("8") || res.contains("8") || res.contains("八") || res.contains("팔")){
                            number = 8;
                        }
                        else if(res.toLowerCase().contains("seven") || res.contains("7") || res.contains("7") || res.contains("七") || res.contains("칠")){
                            number = 7;
                        }
                        else if(res.toLowerCase().contains("six") || res.contains("6") || res.contains("6") || res.contains("六") || res.contains("육")){
                            number = 6;
                        }
                        else if(res.toLowerCase().contains("five") || res.contains("5") || res.contains("5") || res.contains("五") || res.contains("오")){
                            number = 5;
                        }
                        else if(res.toLowerCase().contains("four") || res.contains("4") || res.contains("4") || res.contains("四") || res.contains("사")){
                            number = 4;
                        }
                        else if(res.toLowerCase().contains("three") || res.contains("3") || res.contains("3") || res.contains("三") || res.contains("삼")){
                            number = 3;
                        }
                        else if(res.toLowerCase().contains("two") || res.contains("2") || res.contains("2") || res.contains("二") || res.contains("이")){
                            number = 2;
                        }
                        else if(res.toLowerCase().contains("one") || res.contains("1") || res.contains("1") || res.contains("一") || res.contains("일")){
                            number = 1;
                        }
                    }
                }

refactor this horse shit.

By mister MVC, plus grumpy commenter, 2017-12-13 07:28:20
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.


   O | O | O 
  -----------
   O | O | O 
  -----------
   O | O | O 
     

 */
package tictactoe;

import java.util.Scanner;

public class TicTacToe {

    /**
     * @param args the command line arguments
     * @throws java.lang.InterruptedException
     */
    public static void main(String[] args) throws InterruptedException {
        Scanner input = new Scanner(System.in);
        String a1 = "1";
        String a2 = "2";
        String a3 = "3";
        String a4 = "4";
        String a5 = "5";
        String a6 = "6";
        String a7 = "7";
        String a8 = "8";
        String a9 = "9";
        int inO;
        int inX = 0;
        boolean winner = false;
        PrintBoard(a1,a2,a3,a4,a5,a6,a7,a8,a9);
        System.out.printf("How to play - wait for your turn and when it comes write the number of the field that you want to draw in (from 1 to 9)\n");
        System.out.printf("Player O's turn: ");
        inO = input.nextInt();
        while (true) {
            switch (inO) {
                case 1:
                    if (a1 == "1") {
                        a1 = "O";
                    }
                    break;
                case 2:
                    if (a2 == "2") {
                    a2 = "O";
                    }
                    break;
                case 3:
                    if (a3 == "3") {
                    a3 = "O";
                    }
                    break;
                case 4:
                    if (a4 == "4") {
                    a4 = "O";
                    }
                    break;
                case 5:
                    if (a5 == "5") {
                    a5 = "O";
                    }
                    break;
                case 6:
                    if (a6 == "6") {
                    a6 = "O";
                    }
                    break;
                case 7:
                    if (a7 == "7") {
                    a7 = "O";
                    }
                    break;
                case 8:
                    if (a8 == "8") {
                    a8 = "O";                        
                    }
                    break;
                case 9:
                    if (a9 == "9") {
                    a9 = "O";
                    }
                    break;
                default:
                    System.out.printf("An error occured. Please accept it politely and restart the game.");
                    break;
            }
            System.out.printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
            if (null != Winners(a1,a2,a3,a4,a5,a6,a7,a8,a9))switch (Winners(a1,a2,a3,a4,a5,a6,a7,a8,a9)) {
                case "NONE":
                    if (a1 != "1" && a2 != "2" && a3 != "3" && a4 != "4" && a5 != "5" && a6 != "6" && a7 != "7" && a8 != "8" && a9 != "9") {
                        winner = true;
                        System.out.println("DRAW!");
                        Thread.sleep(3000);
                        break;
                    } else {
                    PrintBoard(a1,a2,a3,a4,a5,a6,a7,a8,a9);
                    System.out.printf("Player X's turn: ");
                    inX = input.nextInt();
                    break;
                    }
                case "X":
                    winner = true;
                    System.out.println("X HAS WON!!!");
                    Thread.sleep(3000);
                    break;
                case "O":
                    winner = true;
                    System.out.printf("O HAS WON!!!");
                    Thread.sleep(3000);
                    break;
                default:
                    break;
            }
            if (winner) {
                break;
            }
            switch (inX) {
                case 1:
                    if (a1 == "1") {
                    a1 = "X";
                    }
                    break;
                case 2:
                    if (a2 == "2") {
                    a2 = "X";
                    }
                    break;
                case 3:
                    if (a3 == "3") {
                    a3 = "X";
                    }
                    break;
                case 4:
                    if (a4 == "4") {
                    a4 = "X";
                    }
                    break;
                case 5:
                    if (a5 == "5") {
                    a5 = "X";
                    }
                    break;
                case 6:
                    if (a6 == "6") {
                    a6 = "X";
                    }
                    break;
                case 7:
                    if (a7 == "7") {
                    a7 = "X";
                    }
                    break;
                case 8:
                    if (a8 == "8") {
                    a8 = "X";
                    }
                    break;
                case 9:
                    if (a9 == "9") {
                    a9 = "X";
                    }
                    break;
                default:
                    System.out.printf("An error occured. Please accept it politely and restart the game.");
                    break;
            }
            System.out.printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
            if (null != Winners(a1,a2,a3,a4,a5,a6,a7,a8,a9))switch (Winners(a1,a2,a3,a4,a5,a6,a7,a8,a9)) {
                case "NONE":
                    if (a1 != "1" && a2 != "2" && a3 != "3" && a4 != "4" && a5 != "5" && a6 != "6" && a7 != "7" && a8 != "8" && a9 != "9") {
                        winner = true;
                        System.out.println("DRAW!");
                        Thread.sleep(3000);
                        break;
                    } else {
                    PrintBoard(a1,a2,a3,a4,a5,a6,a7,a8,a9);
                    System.out.printf("Player O's turn: ");
                    inO = input.nextInt();
                    break;
                    }
                case "X":
                    winner = true;
                    System.out.println("X HAS WON!!!");
                    Thread.sleep(3000);
                    break;
                case "O":
                    winner = true;
                    System.out.println("O HAS WON!!!");
                    Thread.sleep(3000);
                    break;
                default:
                    break;
            }
            if (winner) {
                break;
            }
        }    
    }
    
    public static void PrintBoard(String f1, String f2, String f3, String f4, String f5, String f6, String f7, String f8, String f9) {  
        System.out.printf("   %s | %s | %s \n",f1,f2,f3);
        System.out.printf("  ----------- \n");
        System.out.printf("   %s | %s | %s \n",f4,f5,f6);
        System.out.printf("  ----------- \n");
        System.out.printf("   %s | %s | %s \n",f7,f8,f9);
        System.out.printf(" \n");
    }
    
    public static String Winners(String f1, String f2, String f3, String f4, String f5, String f6, String f7, String f8, String f9) {
        if (f1 == f2 && f2 == f3 && f3 == "O") {
            return "O";
        } else if (f4 == f5 && f5 == f6 && f6 == "O") {
            return "O";
        } else if (f7 == f8 && f8 == f9 && f9 == "O") {
            return "O";
        } else if (f1 == f4 && f4 == f7 && f7 == "O") {
            return "O";
        } else if (f2 == f5 && f5 == f8 && f8 == "O") {
            return "O";
        } else if (f3 == f6 && f6 == f9 && f9 == "O") {
            return "O";
        } else if (f1 == f5 && f5 == f9 && f9 == "O") {
            return "O";
        } else if (f3 == f5 && f5 == f7 && f7 == "O") {
            return "O";
        } else if (f1 == f2 && f2 == f3 && f3 == "X") {
            return "X";
        } else if (f4 == f5 && f5 == f6 && f6 == "X") {
            return "X";
        } else if (f7 == f8 && f8 == f9 && f9 == "X") {
            return "X";
        } else if (f1 == f4 && f4 == f7 && f7 == "X") {
            return "X";
        } else if (f2 == f5 && f5 == f8 && f8 == "X") {
            return "X";
        } else if (f3 == f6 && f6 == f9 && f9 == "X") {
            return "X";
        } else if (f1 == f5 && f5 == f9 && f9 == "X") {
            return "X";
        } else if (f3 == f5 && f5 == f7 && f7 == "X") {
            return "X";
        } else {
            return "NONE";
        }
    }
}

There are so many problems with this...

By umnikos, 2017-12-12 17:38:50