Here you can find the source of decimalDigit(final long value, final int i)
Parameter | Description |
---|---|
value | The source to retrieve the digit |
i | The place to retreive |
public static int decimalDigit(final long value, final int i)
//package com.java2s; //License from project: Apache License public class Main { /**// w ww . j a v a 2s . c om * Return a particular digit value from a given number * @param value The source to retrieve the digit * @param i The place to retreive * @return The digit value */ public static int decimalDigit(final long value, final int i) { int result = (int) (Math.abs(value) % Math.pow(10, i)); if (i > 1) { result /= Math.pow(10, i - 1); } return result; } }