Noob, Java) 코드가 너무 긴거 같아요, i think my code is too long...help me

class Solution {

public int[] solution(int[] numbers) {
    
//조건1,2
   boolean def1 = numbers.length>=2 && numbers.length<=100;
   boolean def2 = true;
       
   for(int i=0; i<numbers.length; i++){
       if(numbers[i]<0 || numbers[i] > 100){
           def2 = false;
       }
   }
    //알고리즘시작 algorithm start;
   if(def1 == false || def2 == false){
       return numbers;
   }
    else{
        int[] answer = new int[numbers.length*(numbers.length-1)/2];
    
        
        int sum=0;
    
        for(int i=0;i<answer.length;i++){
            for(int j=0; j<numbers.length; j++){
                for(int k=1; k<numbers.length && j+k<numbers.length; k++){
                    sum = numbers[j]+numbers[j+k];
                    answer[i]=sum;
                }        	
            }
        }
    
        int temp = 0;
    
        for(int n=0; n<=answer.length-1;n++){
            for(int m=0; m<=answer.length-2; m++){
                if(answer[m]>answer[m+1]){
                    temp = answer[m];
                    answer[m] = answer[m+1];
                    answer[m+1] = temp;
                }
            }      
        }
        
        int p = answer.length;
        for(int q=0;q<(answer.length-1);q++){
            if(answer[q+1]==answer[q]){
                p--;
            }
        }
        
        int w=0;
        int[] RealAnswer = new int[p];
        while(w<RealAnswer.length){
            for(int q=0;q<answer.length;q++){
                if(w == RealAnswer.length-1){
                    RealAnswer[w] = answer[q];
                }
                else if(answer[q+1] != answer[q]){
                    RealAnswer[w]=answer[q];
                    w++;
                }
            }
        }
        return RealAnswer;
    }
}

}