Skip to content

Instantly share code, notes, and snippets.

@BlinkoWang
BlinkoWang / FileUtil.java
Last active August 21, 2024 09:33
convert byte count to human readable
/**
* SI BINARY
* 0: 0 B 0 B
* 27: 27 B 27 B
* 999: 999 B 999 B
* 1000: 1.0 kB 1000 B
* 1023: 1.0 kB 1023 B
* 1024: 1.0 kB 1.0 KiB
* 1728: 1.7 kB 1.7 KiB
* 110592: 110.6 kB 108.0 KiB
import android.content.Context;
import android.support.annotation.UiThread;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.TextView;
import java.util.ArrayList;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
from __future__ import division
def P(n, x, y, z):
if n == 0:
return int(x == 12 and y == 2 and z == 2)
elif n > 0:
if y == 0 and z == 0:
return P(n - 1, x + 1, 0, 0) + 1 / 2 * (P(n - 1, x, 1, 0) + P(n - 1, x, 0, 1))
elif x == 0 and z == 0: