Java tutorial
//package com.java2s; //License from project: Apache License public class Main { public static int[] halfDigit(int num) { int[] array = intToIntArray(num); for (int i = 0; i < array.length; i++) { array[i] = array[i] / 2; } return array; } public static int[] intToIntArray(long num) { String numStr = String.valueOf(num); int[] array = new int[numStr.length()]; for (int i = 0; i < array.length; i++) { array[i] = (numStr.charAt(i) & 0x0F); } return array; } }