/** * Get the processor architecture based on the passed number of bits. * * @param nBits * The number of bits to get the processor architecture from. * @return {@link #UNKNOWN} if no processor architecture could be determined. */ @Nonnull public static EProcessorArchitecture forBits (final int nBits) { for (final EProcessorArchitecture eArch : values ()) if (nBits == eArch.getBits ()) return eArch; return UNKNOWN; }
/** * @return The current processor architecture and never <code>null</code>. */ @Nonnull public static EProcessorArchitecture getProcessorArchitecture () { return EProcessorArchitecture.getCurrentArchitecture (); }
/** * @return The current processor architecture if running inside a Sun JVM. If * no processor architecture could be determined, {@link #UNKNOWN} is * returned and never <code>null</code>. */ @Nonnull static EProcessorArchitecture getCurrentArchitecture () { EProcessorArchitecture ret = s_aInstance; if (ret == null) { // Note: double initialization doesn't matter here ret = forBits (getCurrentArchitectureBits ()); s_aInstance = ret; } return ret; } }