Sha256: e241dbaa4ef87e1fa8b8ad77b65760fa833eb8ecd4f5ef1e95659deba7ed408a

Contents?: true

Size: 404 Bytes

Versions: 290

Compression:

Stored size: 404 Bytes

Contents

import java.util.Arrays;

public class Hexadecimal {
    private static final String HEXES = "0123456789abcdef";
    public static int toDecimal(String input){
        boolean  isHex = input.matches("^[0-9a-f]+");
        if (!isHex) return 0;
        return Arrays.stream(input.split(""))
                .map(HEXES::indexOf)
                .reduce(0, (decimal, hex) -> decimal * 16 + hex);

    }
}


Version data entries

290 entries across 290 versions & 1 rubygems

Version Path
trackler-2.2.1.32 tracks/java/exercises/hexadecimal/.meta/src/reference/java/Hexadecimal.java
trackler-2.2.1.31 tracks/java/exercises/hexadecimal/.meta/src/reference/java/Hexadecimal.java
trackler-2.2.1.30 tracks/java/exercises/hexadecimal/.meta/src/reference/java/Hexadecimal.java
trackler-2.2.1.29 tracks/java/exercises/hexadecimal/.meta/src/reference/java/Hexadecimal.java
trackler-2.2.1.28 tracks/java/exercises/hexadecimal/src/example/java/Hexadecimal.java
trackler-2.2.1.27 tracks/java/exercises/hexadecimal/src/example/java/Hexadecimal.java
trackler-2.2.1.26 tracks/java/exercises/hexadecimal/src/example/java/Hexadecimal.java
trackler-2.2.1.25 tracks/java/exercises/hexadecimal/src/example/java/Hexadecimal.java
trackler-2.2.1.24 tracks/java/exercises/hexadecimal/src/example/java/Hexadecimal.java
trackler-2.2.1.23 tracks/java/exercises/hexadecimal/src/example/java/Hexadecimal.java
trackler-2.2.1.22 tracks/java/exercises/hexadecimal/src/example/java/Hexadecimal.java
trackler-2.2.1.21 tracks/java/exercises/hexadecimal/src/example/java/Hexadecimal.java
trackler-2.2.1.20 tracks/java/exercises/hexadecimal/src/example/java/Hexadecimal.java
trackler-2.2.1.19 tracks/java/exercises/hexadecimal/src/example/java/Hexadecimal.java
trackler-2.2.1.18 tracks/java/exercises/hexadecimal/src/example/java/Hexadecimal.java
trackler-2.2.1.17 tracks/java/exercises/hexadecimal/src/example/java/Hexadecimal.java
trackler-2.2.1.16 tracks/java/exercises/hexadecimal/src/example/java/Hexadecimal.java
trackler-2.2.1.15 tracks/java/exercises/hexadecimal/src/example/java/Hexadecimal.java
trackler-2.2.1.14 tracks/java/exercises/hexadecimal/src/example/java/Hexadecimal.java
trackler-2.2.1.13 tracks/java/exercises/hexadecimal/src/example/java/Hexadecimal.java