Java tutorial
//package com.java2s; import android.os.Bundle; public class Main { public static int[] fillIntsFromKey(Bundle bundle, String baseKey) { int count = countIndexes(bundle, baseKey); int[] array = new int[count]; for (int i = 0; i < array.length; i++) array[i] = bundle.getInt(baseKey + i); return array; } public static int countIndexes(Bundle bundle, String baseKey) { int count = 0; while (bundle.containsKey(baseKey + count)) count++; return count; } }