class ArrayDemo
{
public static void main(String[] args)
{
int[][] arr = {{1,2,3},{4,3},{6,7,8,9}};
System.out.println(sortArr(arr,3));
}
public static String sortArr(int[][]arr,int a)
{
StringBuffer sb=new StringBuffer();
for(int i=0;i<arr.length;i++)
{
for(int j=0;j<arr[i].length;j++)
{
if(arr[i][j]==a)
sb.append("["+i+","+j+"]");
}
}
return sb.toString();
}
}
结果:[0,2][1,1]
|