protected static long toDeviceBitmap(Type[] deviceTypes) {
long bitmap = 0;
if (deviceTypes != null) {
for (int i = 0; i < deviceTypes.length; i++) {
Type type = deviceTypes[i];
if(type == null) {
throw new IllegalArgumentException("Device type at index "+i+" was null.");
}
bitmap |= type.TYPE;
}