Skip to content

Instantly share code, notes, and snippets.

package com.pekall.onlinetest;
public class Solution {
public int equi(int[] A) {
int i, j;
int left = 0;
int right = 0;
int length = A.length;
for (i = 1; i < length; i++) {
shaobin adm dialout cdrom plugdev lpadmin admin sambashare vboxusers
@shaobin0604
shaobin0604 / TitleFlowIndicator.java
Created May 10, 2012 07:33 — forked from franciscojunior/TitleFlowIndicator.java
Sample of viewflow with fragments. Note that you have to use the custom file TitleFlowIndicator below because it contains the support for the FragmentPagerAdapter
/*
* Copyright (C) 2011 Patrik Åkerfeldt
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
package com.tydic;
public class MainCls {
public static void main(String[] args) {
int[] arr = new int[] { 1, 1, 1, 1, 1, 7, 5 };
// tNum1, tNum2 应使用 long 类型,不然数组的加和可能会溢出
int n = arr.length, tNum1 = 0, tNum2 = 0, i, j;
for (i = 0; i < n; i++) {
tNum1 = 0;
// you can also use imports, for example:
// import java.math.*;
class Solution {
public int equi ( int[] A ) {
if (A.length == 0) return -1;
long[] sum = new long[A.length];
sum[0] = A[0];
for (int i = 1; i < A.length; i++) {
sum[i] = sum[i - 1] + A[i];
@shaobin0604
shaobin0604 / android_formating.xml
Created December 31, 2011 08:06
eclipse android code format
<?xml version="1.0" encoding="UTF-8"?>
<profiles version="10">
<profile name="Android" version="10">
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
@shaobin0604
shaobin0604 / gist:1543325
Created December 31, 2011 08:05
eclipse android import order
#Organize Import Order
#Wed Apr 04 11:32:05 CDT 2007
4=javax
3=java
2=android
1=org
0=com
@shaobin0604
shaobin0604 / AACExtractor.cpp
Created November 24, 2011 11:18
AACExtractor on Froyo
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@shaobin0604
shaobin0604 / FlingViewGroup.java
Created November 17, 2011 06:54
FlingViewGroup.java
package org.videolan.vlc.android.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
@shaobin0604
shaobin0604 / cpu_info.java
Created November 11, 2011 06:44
get cpu info
/**
* 获取Cpu
*
*/
private String getCpu() {
ProcessBuilder cmd;
String result = "";
try {
String[] args = { "/system/bin/cat", "/proc/cpuinfo" };
cmd = new ProcessBuilder(args);