2012-10-27 4 views
0

내 응용 프로그램에서는 배열 크기가 400 요소가 있습니다. 내 작업은 그 요소가 삽입을 위해 webservice로 전송됩니다. 그러나 지원되지 않습니다. 배열을 조각으로 나누고 웹 서비스로 보냅니다. 어떻게됩니까?큰 배열을 작은 배열로 분할

+0

일부 코드를 게시하십시오. 배열을 나눠야하는 이유는 모르겠다. – Axel

+0

루프 내에서 Arrays.copyOfRange 함수를 사용하기 만하면됩니다. –

답변

0

아마도 이와 같은 것입니까?

String[] stringArray = new String[400];  
    //lets assume that the array has objects in it. 
    int index = 0; 
    for(int i = 0; i < stringArray.length; i++) { 
     String[] temp = new String[20]; 
     for(int x = 0; x < 20) { 
      if(stringArray[index] != null) temp[x] = stringArray[index]; 
      index++; 
     } 
     //The temp array is filled with objects from the other array, so send it to the webservice. 
     sendArrayToWebService(temp); 
    } 
관련 문제