This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
04c09bf02d48ff700d597f83673dfbf000ff14ee5d3dec13e24b8f3da0794536eabc289a7227430e0df8d797860cbdc82a064fcf10a6914f16b1182f4faed40225 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.sort; | |
import java.util.Stack; | |
public class Sort { | |
public static void main(String[] args) { | |
int[] a = new int[]{3, 9 ,6, 4, 2, 1, 8,10}; | |
//int[] b = bubbleSort(a, a.length); | |
//int[] b = selectionSort(a, a.length); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Collection; | |
import java.util.Map; | |
import java.util.Set; | |
public class CopyOnWriteMap<K, V> implements Map<K, V>, Cloneable { | |
private volatile Map<K, V> internalMap; | |
public CopyOnWriteMap() { | |
internalMap = new HashMap<K, V>(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static Bitmap resize(Context context,Bitmap bitmap,float widthDp, float heightDp) { | |
Matrix matrix = new Matrix(); | |
float rWidth = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, widthDp, context.getResources().getDisplayMetrics()); | |
float rHeight = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, heightDp, context.getResources().getDisplayMetrics()); | |
float wScale = rWidth / bitmap.getWidth(); | |
float hScale = rHeight / bitmap.getHeight(); | |
if(wScale < hScale) { | |
hScale = wScale; | |
} else { | |
wScale = hScale; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//...... | |
private ArrayList<View>[] mScrapViews; | |
private int mViewTypeCount; | |
private ArrayList<View> mCurrentScrap; | |
//...... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SystemUtils { | |
private static final String TAG = "SystemUtils"; | |
public static void getBatteryInfo(Context context) { | |
Intent intent = context.getApplicationContext().registerReceiver(null, | |
new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); | |
int status = intent.getIntExtra(BatteryManager.EXTRA_STATUS, 0); | |
int health = intent.getIntExtra(BatteryManager.EXTRA_HEALTH, 0); | |
boolean present = intent.getBooleanExtra(BatteryManager.EXTRA_PRESENT, false); | |
int level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Time { | |
private static final String TAG = "Time"; | |
public static void getTime() { | |
Calendar now = Calendar.getInstance(); | |
int year = now.get(Calendar.YEAR); | |
int month = now.get(Calendar.MONTH) + 1; // Note: zero based! | |
int day = now.get(Calendar.DAY_OF_MONTH); | |
int hour = now.get(Calendar.HOUR_OF_DAY); | |
int minute = now.get(Calendar.MINUTE); |