public class Solution { public int[] twoSum(int[] nums, int target) { int [] res=new int[2]; int size=nums.length; boolean isGot=false; int i=0; int j=0; for(i=0;i<size;i++) { for(j=i+1;j<size;j++) { if(nums[i]+nums[j]==target) { isGot=true; break; } } if(isGot==true) break; } res[0]=i; res[1]=j; return res; } }