Android Open Source - BsuirSchedule Bit Util






From Project

Back to project page BsuirSchedule.

License

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.

Java Source Code

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;
    }
}




Java Source Code List

net.taviscaron.bsuirschedule.activity.LessonsListActivity.java
net.taviscaron.bsuirschedule.activity.MainActivity.java
net.taviscaron.bsuirschedule.activity.ManageSchedulesActivity.java
net.taviscaron.bsuirschedule.activity.SettingsActivity.java
net.taviscaron.bsuirschedule.adapter.LessonsListAdapter.java
net.taviscaron.bsuirschedule.adapter.SchedulesListAdapter.java
net.taviscaron.bsuirschedule.core.BitUtil.java
net.taviscaron.bsuirschedule.core.BsuirScheduleApplication.java
net.taviscaron.bsuirschedule.core.Constants.java
net.taviscaron.bsuirschedule.core.DateUtil.java
net.taviscaron.bsuirschedule.loader.ScheduleLoader.java
net.taviscaron.bsuirschedule.model.Lesson.java
net.taviscaron.bsuirschedule.model.LessonsListModel.java
net.taviscaron.bsuirschedule.model.Schedule.java
net.taviscaron.bsuirschedule.storage.DBHelper.java