Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { public static synchronized int edfHeaderBytesToInt(byte[] a) { int value = 0; int notspacecount = 0; for (int i = a.length - 1; i >= 0; i--) { if ((a[i] != 32) && (a[i] > 45)) { value = (int) (value + (a[i] - 48) * Math.pow(10, notspacecount)); notspacecount++; } else if (a[i] == 45) { value = value * -1; } } return value; } }