16 진수 16 진수 16 진수를 생성하려고합니다.Groovy 스크립트를 사용하여 임의의 16 자리 16 진수 생성
import org.apache.commons.lang.RandomStringUtils;
def randomhex = RandomStringUtils.randomNumeric(16);
log.info randomhex
def result = Integer.toHexString(randomhex);
log.info result
는 기대 값 : 결과는 임의의 16 자리 16 진수이어야한다. 예 : 328A6D01F9FF12E0
실제 : groovy.lang.MissingMethodException : 아니오 방법 서명 (java.lang.String의) 값 : : 정적 java.lang.Integer.toHexString()는 인수의 형태에 적용 3912632387180714] 가능한 해결책 : toHexString (int), toString(), toString(), toString(), toString (int), toString (int, int) 행의 오류 : 9
오류 메시지가 분명할까요? ToHexString은 int를 취하지 만 문자열을 전달합니다. –
정수로 변환 한 후. import org.apache.commons.lang.RandomStringUtils; def randomhex = RandomStringUtils.randomNumeric (16) .toInteger(); log.info randomhex def result = Integer.toHexString (randomhex); log.info 결과. 오류가 발생합니다 - 'java.lang.NumberFormatException : 입력 문자열의 경우 : "0192171878046802"라인 오류 : 2' – rAJ