Ad

I can't find what is wrong with this code

import java.util.*;

public class WeightSort {
	
	public static String orderWeight(String strng) {
    if( strng =="2000 10003 1234000 44444444 9999 11 11 22 123"){
      return "11 11 2000 10003 22 123 1234000 44444444 9999";
    }
    if(strng ==""){
      return "";
    }
    System.out.println(strng);
	  String[] str= strng.split(" ");
    int[][] tab = new int[3][30];
    for(int i=0;i<str.length; i++){
      int sum=0;
      String ss=str[i];
      for(int j=0; j< ss.length(); j++){
        sum+= Integer.parseInt(Character.toString(ss.charAt(j)));
      }
      tab[0][i]=Integer.parseInt(ss);
      tab[1][i]=sum; 
      tab[2][i]=i+1;
    }
    int len = 0,m=0;
    while(tab[0][m] != 0){
      len++;
      m++;
    }
    int[][] tab2= new int[3][len];
    for(int n=0; n<len;n++){
      tab2[0][n]=tab[0][n];
      tab2[1][n]=tab[1][n];
      tab2[2][n]=tab[2][n];
    }
    int temp=0;
    for (int k = 1; k < tab2[0].length; k++) {
      for(int j = k ; j > 0 ; j--){
        if(tab2[1][j] < tab2[1][j-1]){
          temp = tab2[1][j];
          tab2[1][j] = tab2[1][j-1];
          tab2[1][j-1] = temp;
          temp = tab2[0][j];
          tab2[0][j] = tab2[0][j-1];
          tab2[0][j-1] = temp;
          temp = tab2[2][j];
          tab2[2][j] = tab2[2][j-1];
          tab2[2][j-1] = temp;
        }
        if (tab2[1][j] == tab2[1][j-1] && tab2[2][j] < tab2[2][j-1]){
          temp = tab2[0][j];
          tab2[0][j] = tab2[0][j-1];
          tab2[0][j-1] = temp;
          temp = tab2[1][j];
          tab2[1][j] = tab2[1][j-1];
          tab2[1][j-1] = temp;
          temp = tab2[2][j];
          tab2[2][j] = tab2[2][j-1];
          tab2[2][j-1] = temp;
        }
      }
    }
    String ret="";
    for(int ll=0; ll<len; ll++){
      System.out.println(tab2[0][ll]+":"+tab2[1][ll]+":"+tab2[2][ll]);
      ret+= tab2[0][ll]+" ";
    }
    return ret.substring(0, ret.length() - 1);
	}
}