protected static int lbpriu2(float gc, float g[], int s[]) {		
		int p = g.length;
		for (int i = 0; i < p; i++) {
			s[i] = g[i] - gc >= 0 ? 1 : 0;			
		}		
		
		// Equation (10) in the paper
		int u = 0;
		for (int i = 0; i < p; i++) {
			u += s[i] == s[(i + 1) % p] ? 0 : 1;
		}
		
		// Equation (9) in the paper
		if (u <= 2) {
			int sum = 0;
			for (int i = 0; i < p; i++) {
				sum += s[i];
			}
			return sum;
		} else {
			return p + 1;
		}		
	}