Back to project page BsuirSchedule.
The source code is released under:
Copyright 2012 Andrei Senchuk Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Softwar...
If you think the Android project BsuirSchedule listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package net.taviscaron.bsuirschedule.core; /*w ww . j a va2s . c o m*/ public class BitUtil { public static int encode(int[] bitIndexes) { int result = 0; for (int i = 0; i < bitIndexes.length; i++) { result |= 1 << bitIndexes[i]; } return result; } public static Integer[] decode(int bits) { int count = 0; Integer[] buff = new Integer[32]; for (int i = 0; i < buff.length; i++) { if ((bits & (1 << i)) > 0) { buff[count++] = i; } } Integer[] result = new Integer[count]; System.arraycopy(buff, 0, result, 0, count); return result; } }